// 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()); } }
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); }
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); } }
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); } }
// ===================================================================================== 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); } }
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()); }
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; }