The MamaPublisher class publishes messages to basic or market data subscriptions depending on the underlying transport
Inheritance: MamaWrapper
Esempio n. 1
0
 // Publisher Callbacks
 public void onCreate(MamaPublisher publisher)
 {
     if (!quiet)
     {
         Console.WriteLine("onPublishCreate: " + publisher.getSymbol());
     }
 }
Esempio n. 2
0
 public void onDestroy(MamaPublisher publisher)
 {
     if (!quiet)
     {
         Console.WriteLine("onPublishDestroy: " + publisher.getSymbol());
     }
 }
Esempio n. 3
0
 public void onSendComplete(
     MamaPublisher publisher,
     MamaMsg message,
     MamaStatus.mamaStatus status,
     object closure)
 {
     message.destroy();
 }
Esempio n. 4
0
        public int Run()
        {
            ParseArgs();
            if (helpNeeded)
            {
                DisplayUsage();
                return(0);
            }

            Mama.logToFile(@"mama.log", MamaLogLevel.MAMA_LOG_LEVEL_NORMAL);

            bridge = Mama.loadBridge(middlewareName);

            Mama.open();

            MamaQueue defaultQueue = Mama.getDefaultEventQueue(bridge);

            msg = new MamaMsg();

            MamaTimer timer = new MamaTimer();

            timer.create(defaultQueue, this, interval, null);

            queueGroup = new MamaQueueGroup(bridge, 1);

            MamaTransport transport = new MamaTransport();

            transport.create(transportName, bridge);

            MamaSubscription subscription = null;

            if (nosub == false)
            {
                subscription = new MamaSubscription();
                subscription.createBasic(transport, defaultQueue, this, inboundTopic);
            }

            publisher = new MamaPublisher();
            if (pubCb)
            {
                publisher.createWithCallbacks(transport, queueGroup.getNextQueue(), this, null, outboundTopic, null, null);
            }
            else
            {
                publisher.create(transport, outboundTopic);
            }

            Mama.start(bridge);

            Mama.close();

            return(0);
        }
Esempio n. 5
0
 private void CreatePublisher()
 {
     try
     {
         publisher = new MamaPublisher();
         publisher.create(transport, inboundTopic);
         sendCompleteCallback = new SendCompleteCallback();
     }
     catch (MamaException e)
     {
         Console.WriteLine("Error creating publisher: {0}", e.ToString());
         Exit(1);
     }
 }
Esempio n. 6
0
        private static void onError(IntPtr nativeHandle, short status, string topic, IntPtr closure)
        {
            // Obtain the handle from the closure
            GCHandle handle = (GCHandle)closure;

            // Extract the impl from the handle
            MamaPublisher pub = (MamaPublisher)handle.Target;

            // Use the impl to invoke the error callback
            if (null != pub)
            {
                // Invoke the callback
                pub.mCallback.onError(pub, (MamaStatus.mamaStatus)status, topic);
            }
        }
Esempio n. 7
0
        // =====================================================================================
        private static void onCreate(IntPtr nativeHandle, IntPtr closure)
        {
            // Obtain the handle from the closure
            GCHandle handle = (GCHandle)closure;

            // Extract the impl from the handle
            MamaPublisher pub = (MamaPublisher)handle.Target;

            // Use the impl to invoke the error callback
            if (null != pub)
            {
                // Invoke the callback
                pub.mCallback.onCreate(pub);
            }
        }
Esempio n. 8
0
        private static void onDestroy(IntPtr nativeHandle, IntPtr closure)
        {
            // Obtain the handle from the closure
            GCHandle handle = (GCHandle)closure;

            // Extract the impl from the handle
            MamaPublisher pub = (MamaPublisher)handle.Target;

            Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINE, "DotNet.onDestroy: pub=" + pub);

            // Use the impl to invoke the error callback
            if (null != pub)
            {
                // Invoke the callback
                pub.mCallback.onDestroy(pub);
                handle.Free();
            }
            pub.NativeHandle = IntPtr.Zero;
        }
Esempio n. 9
0
 public void onSuccess(MamaPublisher publisher,
                       MamaStatus.mamaStatus status,
                       string topic)
 {
     Console.WriteLine("onPublishSuccess: " + topic + " " + status.ToString());
 }
Esempio n. 10
0
 public void onError(MamaPublisher publisher,
                     MamaStatus.mamaStatus status,
                     string topic)
 {
     Console.WriteLine("onPublishError: " + topic + " " + status.ToString());
 }
Esempio n. 11
0
			public void onSendComplete(
				MamaPublisher publisher,
				MamaMsg message,
				MamaStatus.mamaStatus status,
				object closure)
			{
				message.destroy();
			}
Esempio n. 12
0
		private void CreatePublisher()
		{
			try
			{
				publisher = new MamaPublisher();
				publisher.create(transport, inboundTopic);
				sendCompleteCallback = new SendCompleteCallback();
			}
			catch (MamaException e)
			{
				Console.WriteLine("Error creating publisher: {0}", e.ToString());
				Exit(1);
			}
		}
Esempio n. 13
0
        public int Run()
        {
            ParseArgs();
            if (helpNeeded)
            {
                DisplayUsage();
                return 0;
            }

            Mama.logToFile(@"mama.log", MamaLogLevel.MAMA_LOG_LEVEL_NORMAL);

            bridge = Mama.loadBridge(middlewareName);

            Mama.open();

            MamaQueue defaultQueue = Mama.getDefaultEventQueue(bridge);
            msg = new MamaMsg();

            MamaTimer timer = new MamaTimer();
            timer.create(defaultQueue, this, interval, null);

            queueGroup = new MamaQueueGroup(bridge, 1);

            MamaTransport transport = new MamaTransport();
            transport.create(transportName, bridge);

            MamaSubscription subscription = null;
            if (nosub == false)
            {
                subscription = new MamaSubscription();
                subscription.createBasic(transport, defaultQueue, this, inboundTopic);
            }

            publisher = new MamaPublisher();
            if (pubCb)
            {
                publisher.createWithCallbacks(transport, queueGroup.getNextQueue(), this, null, outboundTopic, null, null);
            }
            else
            {
                publisher.create(transport, outboundTopic);
            }

            Mama.start(bridge);

            Mama.close();

            return 0;
        }
Esempio n. 14
0
 public void onError(MamaPublisher publisher,
              MamaStatus.mamaStatus status,
              string topic)
 {
     Console.WriteLine("onPublishError: " + topic + " " + status.ToString());
 }
Esempio n. 15
0
 public void onDestroy(MamaPublisher publisher)
 {
     if (!quiet)
     {
         Console.WriteLine("onPublishDestroy: " + publisher.getSymbol());
     }
 }
Esempio n. 16
0
 // Publisher Callbacks
 public void onCreate(MamaPublisher publisher)
 {
     if (!quiet)
     {
         Console.WriteLine("onPublishCreate: " + publisher.getSymbol());
     }
 }