示例#1
0
        /// <summary>
        /// Activate the subscription.  Until this method is invoked, no
        /// updates will be received.
        /// </summary>
        public void activate()
        {
            if (mSubscription != null)
            {
                return;
            }

            mSubscription = new MamaSubscription();

            mSubscription.setSubscriptionType(mType);
            mSubscription.setServiceLevel(mServiceLevel, mServiceLevelOpt);
            mSubscription.setRequiresInitial(mRequireInitial);
            mSubscription.setRetries(mRetries);
            mSubscription.setTimeout(mTimeout);

            mMamaSource.transport       = mTransport;
            mMamaSource.symbolNamespace = mSource;

            mSubscription.create(
                mQueue,
                new MamdaSubscriptionCallback(this),
                mMamaSource,
                mSymbol,
                null);
        }
示例#2
0
		/// <summary>
		/// Activate the subscription.  Until this method is invoked, no
		/// updates will be received.
		/// </summary>
		public void activate()
		{
			if (mSubscription != null) return;

			mSubscription = new MamaSubscription();

			mSubscription.setSubscriptionType(mType);
			mSubscription.setServiceLevel(mServiceLevel, mServiceLevelOpt);
			mSubscription.setRequiresInitial(mRequireInitial);
			mSubscription.setRetries(mRetries);
			mSubscription.setTimeout(mTimeout);

			mMamaSource.transport = mTransport;
			mMamaSource.symbolNamespace = mSource;

			mSubscription.create(
				mQueue,
				new MamdaSubscriptionCallback(this),
				mMamaSource,
				mSymbol,
				null);
		}
示例#3
0
        /// <summary>
        /// This function will create subscriptions for all the symbols in the array list.
        /// </summary>
        private void createSubscriptions()
        {
            // There must be at least 1 symbol
            if (m_symbols.Count < 1)
            {
                throw new ApplicationException("There are no symbols to subscribe to.");
            }

            ListenerSubscriptionCallback subscriptionCallback = new ListenerSubscriptionCallback(m_dictionary, m_iterator, m_quietness, m_symbols.Count);

            // Enumerate all the symbol names and create a subscription for each one
            foreach (string symbol in m_symbols)
            {
                MamaSubscription subscription = new MamaSubscription();

                // Set the service level depending on whether we need a snapshot subscription or not
                if (m_snapshot)
                {
                    subscription.setServiceLevel(mamaServiceLevel.MAMA_SERVICE_LEVEL_SNAPSHOT);
                }

                else
                {
                    subscription.setServiceLevel(mamaServiceLevel.MAMA_SERVICE_LEVEL_REAL_TIME);
                }

                // Complete the remaining properties
                subscription.setSubscriptionType(mamaSubscriptionType.MAMA_SUBSC_TYPE_NORMAL);
                subscription.setTimeout(10);
                subscription.setRetries(3);
                subscription.setRequiresInitial(true);

                /* Determine the queue to use, if there are multiple threads running then the next queue in the
                 * group will be acquired.
                 */
                MamaQueue queue = m_defaultQueue;
                if (m_queueGroup != null)
                {
                    queue = m_queueGroup.getNextQueue();
                }

                subscription.create(queue, subscriptionCallback, m_source, symbol);

                // Add the subscription to the array list so that they can all be destroyed later on
                m_subscriptions.Add(subscription);
            }
        }