Example #1
0
        /// <summary>
        /// Create a mama publisher for the corresponding transport. If the transport
        /// is a marketdata transport, as opposed to a "basic" transport, the topic
        /// corresponds to the symbol. For a basic transport, the source and root get
        /// ignored.
        /// </summary>
        /// <param name="transport">The transport.</param>
        /// <param name="topic">Symbol on which to publish.</param>
        /// <param name="source">The source for market data publishers. (e.g. source.symbol)</param>
        /// <param name="root">The root for market data publishers. Used internally.</param>
        public void createWithCallbacks(
            MamaTransport transport,
            MamaQueue queue,
            MamaPublisherCallback callback,
            Object closure,
            string topic,
            string source,
            string root)
        {
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
            if (transport == null)
            {
                throw new ArgumentNullException("transport");
            }
            if (topic == null)
            {
                throw new ArgumentNullException("topic");
            }
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (nativeHandle != IntPtr.Zero)
            {
                throw new InvalidOperationException("MamaPublisher already created");
            }
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
            mCallback = callback;

            GCHandle handle = GCHandle.Alloc(this);

            int code = NativeMethods.mamaPublisher_createWithCallbacks(
                ref nativeHandle,
                transport.NativeHandle,
                queue.NativeHandle,
                topic, source, root,
                ref mCallbackDelegates,
                (IntPtr)handle);
            CheckResultCode(code);

            GC.KeepAlive(transport);
            GC.KeepAlive(queue);
            GC.KeepAlive(callback);
        }
Example #2
0
        /// <summary>
        /// Create a mama publisher for the corresponding transport. If the transport
        /// is a marketdata transport, as opposed to a "basic" transport, the topic
        /// corresponds to the symbol. For a basic transport, the source and root get 
        /// ignored.
        /// </summary>
        /// <param name="transport">The transport.</param>
        /// <param name="topic">Symbol on which to publish.</param>
        /// <param name="source">The source for market data publishers. (e.g. source.symbol)</param>
        /// <param name="root">The root for market data publishers. Used internally.</param>
        public void createWithCallbacks(
            MamaTransport transport,
            MamaQueue queue,
            MamaPublisherCallback callback,
            Object closure,
            string topic,
            string source,
            string root)
        {
            #if MAMA_WRAPPERS_CHECK_ARGUMENTS
            if (transport == null)
            {
                throw new ArgumentNullException("transport");
            }
            if (topic == null)
            {
                throw new ArgumentNullException("topic");
            }
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (nativeHandle != IntPtr.Zero)
            {
                throw new InvalidOperationException("MamaPublisher already created");
            }
            #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
            mCallback = callback;

            GCHandle handle = GCHandle.Alloc(this);

            int code = NativeMethods.mamaPublisher_createWithCallbacks(
                ref nativeHandle,
                transport.NativeHandle,
                queue.NativeHandle,
                topic, source, root,
                ref mCallbackDelegates,
                (IntPtr)handle);
            CheckResultCode(code);

            GC.KeepAlive(transport);
            GC.KeepAlive(queue);
            GC.KeepAlive(callback);
        }