The MamaPublisher class publishes messages to basic or market data subscriptions depending on the underlying transport
Inheritance: MamaWrapper
 // Publisher Callbacks
 public void onCreate(MamaPublisher publisher)
 {
     if (!quiet)
     {
         Console.WriteLine("onPublishCreate: " + publisher.getSymbol());
     }
 }
 public void onDestroy(MamaPublisher publisher)
 {
     if (!quiet)
     {
         Console.WriteLine("onPublishDestroy: " + publisher.getSymbol());
     }
 }
Exemple #3
0
 public void onSendComplete(
     MamaPublisher publisher,
     MamaMsg message,
     MamaStatus.mamaStatus status,
     object closure)
 {
     message.destroy();
 }
        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);
        }
Exemple #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);
     }
 }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
Exemple #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;
        }
 public void onSuccess(MamaPublisher publisher,
                       MamaStatus.mamaStatus status,
                       string topic)
 {
     Console.WriteLine("onPublishSuccess: " + topic + " " + status.ToString());
 }
 public void onError(MamaPublisher publisher,
                     MamaStatus.mamaStatus status,
                     string topic)
 {
     Console.WriteLine("onPublishError: " + topic + " " + status.ToString());
 }
Exemple #11
0
			public void onSendComplete(
				MamaPublisher publisher,
				MamaMsg message,
				MamaStatus.mamaStatus status,
				object closure)
			{
				message.destroy();
			}
Exemple #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);
			}
		}
Exemple #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;
        }
Exemple #14
0
 public void onError(MamaPublisher publisher,
              MamaStatus.mamaStatus status,
              string topic)
 {
     Console.WriteLine("onPublishError: " + topic + " " + status.ToString());
 }
Exemple #15
0
 public void onDestroy(MamaPublisher publisher)
 {
     if (!quiet)
     {
         Console.WriteLine("onPublishDestroy: " + publisher.getSymbol());
     }
 }
Exemple #16
0
 // Publisher Callbacks
 public void onCreate(MamaPublisher publisher)
 {
     if (!quiet)
     {
         Console.WriteLine("onPublishCreate: " + publisher.getSymbol());
     }
 }