コード例 #1
0
            // the mCallback implementation
            private void onIterate(IntPtr sourceGroup, IntPtr source, uint weight, IntPtr closure)
            {
                MamaSource         ms = new MamaSource(source);
                MamaWeightedSource ws = new MamaWeightedSource(ms, weight);

                mItems.Add(ws);
                GC.KeepAlive(ms);
                GC.KeepAlive(ws);
            }
コード例 #2
0
        /// <summary>
        /// CLS compliant version of add(MamaSource, UInt32)
        /// </summary>
        public void add(
            MamaSource source,
            int weight)
        {
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
            if (weight < 0)
            {
                throw new ArgumentOutOfRangeException("weight", weight);
            }
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
            add(source, (uint)weight);
        }
コード例 #3
0
        /// <summary>
        /// Implements <see cref="ISourceManager.add(MamaSource)">ISourceManager.add(MamaSource)</see>
        /// </summary>
        public void add(MamaSource source)
        {
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
            EnsurePeerCreated();

            int code = NativeMethods.mamaSourceManager_addSource(nativeHandle, source.NativeHandle);
            CheckResultCode(code);
            GC.KeepAlive(source);
        }
コード例 #4
0
        /// <summary>
        /// Add a mamaSource to the specified mGroup with the specified weighting and string name identifier.
        /// </summary>
        /// <param name="sourceName">The unique identifier for this source in this mGroup.</param>
        /// <param name="weight">The weighing to apply to the source being added.</param>
        /// <param name="source">The mamaSource being added to the mamaSourceGroup.</param>
        public void add(
            string sourceName,
            uint weight,
            MamaSource source)
        {
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
            if (sourceName == null)
            {
                throw new ArgumentNullException("sourceName", sourceName);
            }
            if (source == null)
            {
                throw new ArgumentNullException("source", source);
            }
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
            EnsurePeerCreated();
            int code = NativeMethods.mamaSourceGroup_addSourceWithName(nativeHandle, source.NativeHandle, sourceName, weight);
            CheckResultCode(code);
            GC.KeepAlive(source);
        }
コード例 #5
0
ファイル: MamaDictionary.cs プロジェクト: jacobraj/MAMA
	  /// <summary>
	  /// Create a data dictionary from a subscription
	  /// </summary>
		public void create(
			MamaQueue queue,
			MamaDictionaryCallback callback,
			MamaSource source,
			int retries,
			double timeout) 
		{
			mCallbackForwarder = new CallbackForwarder(this, callback);

			IntPtr queuePtr = queue != null ? queue.NativeHandle : IntPtr.Zero;
			IntPtr sourcePtr = source != null ? source.NativeHandle : IntPtr.Zero;

			mCallbacks = mCallbackForwarder.getMsgCallbacks();

			int code = NativeMethods.mama_createDictionary(ref nativeHandle, queuePtr, mCallbacks, sourcePtr, timeout, retries, nativeHandle);
			CheckResultCode(code);

			GC.KeepAlive(source);
			GC.KeepAlive(queue);
		}
コード例 #6
0
        /// <summary>
        /// Create a data dictionary from a subscription
        /// </summary>
        public void create(
            MamaQueue queue,
            MamaDictionaryCallback callback,
            MamaSource source,
            int retries,
            double timeout)
        {
            mCallbackForwarder = new CallbackForwarder(this, callback);

            IntPtr queuePtr  = queue != null ? queue.NativeHandle : IntPtr.Zero;
            IntPtr sourcePtr = source != null ? source.NativeHandle : IntPtr.Zero;

            mCallbacks = mCallbackForwarder.getMsgCallbacks();

            int code = NativeMethods.mama_createDictionary(ref nativeHandle, queuePtr, mCallbacks, sourcePtr, timeout, retries, nativeHandle);

            CheckResultCode(code);

            GC.KeepAlive(source);
            GC.KeepAlive(queue);
        }
コード例 #7
0
        /// <summary>
        /// Set the parameters for a subscription that may be actually activated later.
        /// Activate the subscription using MamaSubscription.activate().
        /// </summary>
        /// <param name="queue">
        /// The mama queue.
        /// </param>
        /// <param name="callback">
        /// The callback.
        /// </param>
        /// <param name="source">
        /// The MamaSource identifying the publisher for this symbol.
        /// </param>
        /// <param name="symbol">
        /// The symbol for the listener.
        /// </param>
        /// <param name="closure">
        /// The caller supplied closure.
        /// </param>
        public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure)
        {
            // Verify that the subscription has been created
            EnsurePeerCreated();

            // Save arguments in member variables
            base.mClosure   = closure;
            base.mQueue     = queue;
            base.mTransport = source.transport;

            // Create the impl
            IntPtr impl = MamaSubscriptionImpl.Create(callback, closure, this);

            // Call into the native layer to setup the subscription
            CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setup(
                                NativeHandle,
                                queue.NativeHandle,
                                ref MamaBasicSubscription.mCallbackDelegates,
                                source.NativeHandle,
                                symbol,
                                impl));
        }
コード例 #8
0
 internal MamaWeightedSource(MamaSource source, uint weight)
 {
     mSource = source;
     mWeight = weight;
 }
コード例 #9
0
ファイル: MamdaMultiPartTicker.cs プロジェクト: jacobraj/MAMA
        private static MamaDictionary buildDataDictionary(
			MamaTransport transport,
			MamaQueue defaultQueue,
			MamaSource dictionarySource)
        {
            bool[] gotDict = new bool[] { false };
            MamaDictionaryCallback dictionaryCallback = new DictionaryCallback(gotDict);
            lock (dictionaryCallback)
            {
                MamaSubscription subscription = new MamaSubscription ();

                MamaDictionary dictionary = new MamaDictionary();
                dictionary.create(
                    defaultQueue,
                    dictionaryCallback,
                    dictionarySource,
                    3,
                    10);

                Mama.start(myBridge);
                if (!gotDict[0])
                {
                    if (!Monitor.TryEnter(dictionaryCallback, 30000))
                    {
                        Console.Error.WriteLine("Timed out waiting for dictionary.");
                        Environment.Exit(0);
                    }
                    Monitor.Exit(dictionaryCallback);
                }
                return dictionary;
            }
        }
コード例 #10
0
ファイル: MamaSource.cs プロジェクト: jacobraj/MAMA
		/// <summary>
		/// Implements <see cref="ISourceManager.add(MamaSource)">ISourceManager.add(MamaSource)</see>
		/// </summary>
		public void add(MamaSource source)
		{
			Manager.add(source);
		}
コード例 #11
0
ファイル: MamaSource.cs プロジェクト: jacobraj/MAMA
		/// <summary>
		/// Implements <see cref="ISourceManager.add(System.String, MamaSource)">ISourceManager.add(System.String, MamaSource)</see>
		/// </summary>
		public void add(string name, MamaSource source)
		{
			Manager.add(name, source);
		}
コード例 #12
0
ファイル: MamaSubscription.cs プロジェクト: jacobraj/MAMA
 /// <summary>
 /// Set the parameters for a subscription that may be actually activated later.  
 /// Activate the subscription using MamaSubscription.activate().
 /// This overload passes a null value for the closure.
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.</param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>        
 public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol)
 {
     // Call the overload passing null for the closure
     setup(queue, callback, source, symbol, null);
 }
コード例 #13
0
		private static void initializeMama()
		{
			Mama.enableLogging(mamaLogLevel);

			try
			{
				myBridge = Mama.loadBridge (myMiddleware);
				/* Always the first API method called. Initialized internal API
				 * state*/
				Mama.open ();
				myDefaultQueue = Mama.getDefaultEventQueue (myBridge);
			}
			catch (Exception e)
			{
				Console.WriteLine(e.ToString());
				Console.WriteLine("Failed to initialize MAMA");
				Environment.Exit (1);
			}

			transport = new MamaTransport ();
			/* The name specified here is the name identifying properties in the
			 * mama.properties file*/
			transport.create (transportName, myBridge);

			if (myDictTportName != null)
			{
				myDictTransport = new MamaTransport ();
				myDictTransport.create (myDictTportName, myBridge);
			}
			else 
			{
				myDictTransport = transport;
			}

			/*MamaSource for all subscriptions*/
			mySource     = new MamaSource ();
			mySource.transport = transport;
			mySource.symbolNamespace = mySymbolNamespace;

			/*MamaSource for dictionary subscription*/
			myDictSource = new MamaSource ();
			myDictSource.transport = myDictTransport;
			myDictSource.symbolNamespace = dictSource;
		}
コード例 #14
0
ファイル: MamaSourceGroup.cs プロジェクト: jacobraj/MAMA
		/// <summary>
		/// Add a mamaSource to the specified mGroup with the specified weighting.
		/// </summary>
		/// <remarks>The source id will be used by the mGroup to uniquely identify the source.</remarks>
		/// <param name="source">The mamaSource being added to the mamaSourceGroup.</param>
		/// <param name="weight">The weighing to apply to the source being added.</param>
		public void add(
			MamaSource source, 
			uint weight)
		{
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
			if (source == null)
			{
				throw new ArgumentNullException("source", source);
			}
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
			EnsurePeerCreated();
			int code = NativeMethods.mamaSourceGroup_addSource(nativeHandle, source.NativeHandle, weight);
			CheckResultCode(code);
			GC.KeepAlive(source);
		}
コード例 #15
0
ファイル: MamaWeightedSource.cs プロジェクト: jacobraj/MAMA
		internal MamaWeightedSource(MamaSource source, uint weight)
		{
			mSource = source;
			mWeight = weight;
		}
コード例 #16
0
ファイル: MamdaMultiPartTicker.cs プロジェクト: jacobraj/MAMA
        public static void Main(string[] args)
        {
            MamaTransport        transport    = null;
            MamaQueue            defaultQueue = null;
            MamaDictionary       dictionary   = null;
            CommandLineProcessor options      = new CommandLineProcessor(args);
            double               throttleRate = options.getThrottleRate();

            if (options.hasLogLevel())
            {
                logLevel_ = options.getLogLevel();
                Mama.enableLogging(logLevel_);
            }

            if ((throttleRate > 100.0) || (throttleRate <= 0.0))
            {
                throttleRate = 100.0;
            }

            try
            {
                // Initialize MAMDA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();

                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);
                //Get the Data dictionary.....
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = options.getDictSource();
                dictionarySource.transport = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);

                //Initialise the dictionary and fields
                MamdaCommonFields.setDictionary(dictionary, null);
                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);

                foreach (string symbol in options.getSymbolList())
                {
                    MamdaSubscription aSubscription = new MamdaSubscription();
                    aSubscription.setType(mamaSubscriptionType.MAMA_SUBSC_TYPE_GROUP);
                    aSubscription.create(
                        transport,
                        defaultQueue,
                        options.getSource(),
                        symbol,
                        null);

                    /* For each subscription a MamdaMultiParticipantManager is
                    * added as the message listener. The callbacks on the
                    * MamdaMultiPartHandler will be invokes as new group members
                    * become available.*/
                    MamdaMultiParticipantManager multiPartManager =
                        new MamdaMultiParticipantManager(symbol);
                    multiPartManager.addHandler(new MultiPartHandler());

                    aSubscription.addMsgListener(multiPartManager);

                    aSubscription.activate();

                   mamdaSubscriptions.Add(aSubscription);
                }

                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.WriteLine("Press ENTER or Ctrl-C to quit...");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
コード例 #17
0
 /// <summary>
 /// Implements <see cref="ISourceManager.add(System.String, MamaSource)">ISourceManager.add(System.String, MamaSource)</see>
 /// </summary>
 public void add(string name, MamaSource source)
 {
     Manager.add(name, source);
 }
コード例 #18
0
ファイル: MamaListenCS.cs プロジェクト: varauder/OpenMAMA
        /// <summary>
        /// This function will clean up all the objects initialised before Mama.start is called.
        /// </summary>
        private void uninitializeMama()
        {
            if (m_source != null)
            {
                m_source.destroy();
                m_source = null;
            }

            if (m_dictionary != null)
            {
                m_dictionary.Dispose();
                m_dictionary = null;
            }

            if (m_queueGroup != null)
            {
                m_queueGroup.destroyWait();
                m_queueGroup = null;
            }

            if (m_transport != null)
            {
                m_transport.destroy();
                m_transport = null;
            }

            Mama.close();
        }
コード例 #19
0
ファイル: MamaListenCS.cs プロジェクト: varauder/OpenMAMA
        /// <summary>
        /// Creates the source required to establish market data subscriptions.
        /// </summary>
        private void createSource()
        {
            // Allocate a new source object
            m_source = new MamaSource();

            // Set the source name and main transport
            m_source.symbolNamespace = m_sourceName;
            m_source.transport       = m_transport;
        }
コード例 #20
0
ファイル: MamaListenCS.cs プロジェクト: varauder/OpenMAMA
        /// <summary>
        /// This function will create the dictionary.
        /// </summary>
        private void createDictionary()
        {
            if (m_downloadDictionary)
            {
                using (MamaSource dictionarySource = new MamaSource())
                {
                    /* If a dictionary transport has been specified then a new one must be created otherwise
                     * the main transport will be re-used.
                     */
                    MamaTransport dictionaryTransport = null;
                    try
                    {
                        if((m_dictionaryTransportName == null) || (m_dictionaryTransportName == string.Empty))
                        {
                            dictionarySource.transport = m_transport;
                        }
                        else
                        {
                            dictionaryTransport = new MamaTransport();
                            dictionaryTransport.create(m_dictionaryTransportName, m_bridge);

                            dictionarySource.transport = dictionaryTransport;
                        }

                        // The symbol namespace must also be set
                        dictionarySource.symbolNamespace = m_dictionarySourceName;

                        // Instantiate a callback class
                        ListenerDictionaryCallback dictionaryCallback = new ListenerDictionaryCallback(m_bridge);

                        // Create the actual dictionary object using the default queue
                        m_dictionary = new MamaDictionary();
                        m_dictionary.create(m_defaultQueue, dictionaryCallback, dictionarySource, 3, 10.0);

                        // Start the bridge, this will block until the dictionary is downloaded or something goes wrong
                        Mama.start(m_bridge);

                        // If something went wrong then throw an exception
                        if (!dictionaryCallback.DictionaryComplete)
                        {
                            throw new ApplicationException("Can't create dictionary.");
                        }
                    }

                    finally
                    {
                        if (dictionaryTransport != null)
                        {
                            dictionaryTransport.destroy();
                        }
                    }
                }
            }
        }
コード例 #21
0
ファイル: MamaSourceGroup.cs プロジェクト: jacobraj/MAMA
			// the mCallback implementation
			private void onIterate(IntPtr sourceGroup, IntPtr source, uint weight, IntPtr closure)
			{
				MamaSource ms = new MamaSource(source);
				MamaWeightedSource ws = new MamaWeightedSource(ms, weight);
				mItems.Add(ws);
				GC.KeepAlive(ms);
				GC.KeepAlive(ws);
			}
コード例 #22
0
ファイル: MamaSourceGroup.cs プロジェクト: jacobraj/MAMA
		/// <summary>
		/// CLS compliant version of add(System.String, UInt32, MamaSource)
		/// </summary>
		public void add(
			string sourceName,
			int weight,
			MamaSource source)
		{
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
			if (weight < 0)
			{
				throw new ArgumentOutOfRangeException("weight", weight);
			}
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
			add(sourceName, (uint)weight, source);
		}
コード例 #23
0
 /// <summary>
 /// Implements <see cref="ISourceManager.add(MamaSource)">ISourceManager.add(MamaSource)</see>
 /// </summary>
 public void add(MamaSource source)
 {
     Manager.add(source);
 }
コード例 #24
0
 /// <summary>
 /// Set the parameters for a subscription that may be actually activated later.
 /// Activate the subscription using MamaSubscription.activate().
 /// This overload passes a null value for the closure.
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.</param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>
 public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol)
 {
     // Call the overload passing null for the closure
     setup(queue, callback, source, symbol, null);
 }
コード例 #25
0
ファイル: MamaSubscription.cs プロジェクト: jacobraj/MAMA
 /// <summary>
 /// Set up and activate a subscriber using the throttle queue. This
 /// method is equivalent to calling setup() followed by activate().
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.
 /// </param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>
 public void create(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol)
 {
     // Call the overload with a null closure
     create(queue, callback, source, symbol, null);
 }
コード例 #26
0
ファイル: MamaChurnCS.cs プロジェクト: jacobraj/MAMA
        private void initializeMama()
        {
            mamaBridge = Mama.loadBridge(mamaMiddlewareName);

            Console.WriteLine(Mama.getVersion(mamaBridge));

            Mama.open();

            if (mamaHighWaterMark > 0 || mamaLowWaterMark > 0)
            {
                if (mamaHighWaterMark > 0)
                {
                    Mama.setDefaultQueueHighWatermark(mamaHighWaterMark);
                }

                if (mamaLowWaterMark > 0)
                {
                    try
                    {
                        Mama.setDefaultQueueLowWatermark(mamaLowWaterMark);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Could not set default queue low water mark MamaStatus: " + e);
                    }
                }
            }

            // create the transport
            mamaTransport = new MamaTransport();

            mamaTransport.setTransportCallback(this);

            // the default throttle rate is 500 msg/sec
            if (mamaThrottle != -1)
            {
                mamaTransport.setOutboundThrottle(MamaTransport.MamaThrottleInstance.MAMA_THROTTLE_DEFAULT, mamaThrottle);
            }

            // the default recap throttle rate is 250 msg/sec
            if (mamaRecapThrottle != -1)
            {
                mamaTransport.setOutboundThrottle(MamaTransport.MamaThrottleInstance.MAMA_THROTTLE_RECAP, mamaRecapThrottle);
            }

            mamaTransport.create(mamaTransportName, mamaBridge);

            // create default queue and, if required, queue group
            createQueues();

            mamaDictionarySource = new MamaSource();
            mamaDictionarySource.symbolNamespace = mamaDictionarySourceName;
            mamaDictionarySource.transport = mamaTransport;

            // download dictionary
            mamaDictionary = new MamaDictionary();

            mamaDictionary.create(
                mamaDefaultQueue,
                this,
                mamaDictionarySource,
                3,
                10.0f);

            loadSymbolMap();

            Mama.start(mamaBridge);

            if (!dictionaryComplete)
            {
                throw new Exception("Can't create dictionary.");
            }

        }
コード例 #27
0
 /// <summary>
 /// Set up and activate a subscriber using the throttle queue. This
 /// method is equivalent to calling setup() followed by activate().
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.
 /// </param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>
 public void create(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol)
 {
     // Call the overload with a null closure
     create(queue, callback, source, symbol, null);
 }
コード例 #28
0
ファイル: MamaSubscription.cs プロジェクト: jacobraj/MAMA
        /// <summary>
		/// Set up and activate a subscriber using the throttle queue. This
		/// method is equivalent to calling setup() followed by activate().
		/// </summary>
		/// <param name="queue">
        /// The mama queue.
        /// </param>
		/// <param name="callback">
        /// The callback.
        /// </param>
		/// <param name="source">
        /// The MamaSource identifying the publisher for this symbol.
        /// </param>
		/// <param name="symbol">
        /// The symbol for the listener.
        /// </param>
		/// <param name="closure">
        /// The caller supplied closure.
        /// </param>
		public void create(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure)
		{
			// This is equivalent to calling setup then activate
            setup(queue, callback, source, symbol, closure);
            activate();
		}
コード例 #29
0
ファイル: MamaSourceManager.cs プロジェクト: jacobraj/MAMA
		/// <summary>
		/// Implements <see cref="ISourceManager.add(System.String, MamaSource)">ISourceManager.add(System.String, MamaSource)</see>
		/// </summary>
		public void add(string name, MamaSource source)
		{
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
			if (name == null)
			{
				throw new ArgumentNullException("name");
			}
			if (source == null)
			{
				throw new ArgumentNullException("source");
			}
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
			EnsurePeerCreated();

			int code = NativeMethods.mamaSourceManager_addSourceWithName(nativeHandle, source.NativeHandle, name);
			CheckResultCode(code);
			GC.KeepAlive(source);
		}
コード例 #30
0
 /// <summary>
 /// Set up and activate a subscriber using the throttle queue. This
 /// method is equivalent to calling setup() followed by activate().
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.
 /// </param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>
 /// <param name="closure">
 /// The caller supplied closure.
 /// </param>
 public void create(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure)
 {
     // This is equivalent to calling setup then activate
     setup(queue, callback, source, symbol, closure);
     activate();
 }
コード例 #31
0
ファイル: MamaChurnCS.cs プロジェクト: jacobraj/MAMA
        private void createSubscriptions()
        {
            mamaSource = new MamaSource();
            mamaSource.symbolNamespace = mamaSourceName;
            mamaSource.transport = mamaTransport;

            for (int i = 0; i < mamaNumSymbols; i++)
            {
                mamaSubscriptions[i] = new MamaSubscription();

                mamaSubscriptions[i].setServiceLevel(mamaServiceLevel.MAMA_SERVICE_LEVEL_REAL_TIME);

                mamaSubscriptions[i].setSubscriptionType(mamaSubscriptionType.MAMA_SUBSC_TYPE_NORMAL);

                mamaSubscriptions[i].setTimeout(10);

                mamaSubscriptions[i].setRetries(3);

                mamaSubscriptions[i].setRequiresInitial(true);

                mamaSubscriptions[i].create(
                    mamaQueueGroup == null ? mamaDefaultQueue : mamaQueueGroup.getNextQueue(),
                    this,
                    mamaSource,
                    mamaSymbols[i]);
            }
        }
コード例 #32
0
ファイル: MamaSubscription.cs プロジェクト: jacobraj/MAMA
		/// <summary>
        /// Set the parameters for a subscription that may be actually activated later.  
        /// Activate the subscription using MamaSubscription.activate().
        /// </summary>
        /// <param name="queue">
        /// The mama queue.
        /// </param>
        /// <param name="callback">
        /// The callback.
        /// </param>
        /// <param name="source">
        /// The MamaSource identifying the publisher for this symbol.
        /// </param>
        /// <param name="symbol">
        /// The symbol for the listener.
        /// </param>
        /// <param name="closure">
        /// The caller supplied closure.
        /// </param>
        public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure)
        {
            // Verify that the subscription has been created
            EnsurePeerCreated();

            // Save arguments in member variables
            base.mClosure      = closure;
            base.mQueue        = queue;
            base.mTransport    = source.transport;

            // Create the impl
            IntPtr impl = MamaSubscriptionImpl.Create(callback, closure, this);

            // Call into the native layer to setup the subscription
            CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setup(
                NativeHandle,
                queue.NativeHandle,
                ref MamaBasicSubscription.mCallbackDelegates,
                source.NativeHandle,
                symbol,
                impl));
        }