public void PublishTestWithCallbacksErrors() { int numPublishes = 10; for (int i = 0; i < numPublishes; ++i) { MamaPublisher pub = new MamaPublisher(); pub.createWithCallbacks(m_transport, Mama.getDefaultEventQueue(m_bridge), this, null, MamaCommon.symbol, "BADSRC", null); string topic = pub.getSource() + "." + pub.getSymbol(); // test getters m_msg.clear(); m_msg.addU8("", (ushort)MamaReservedFields.MsgType.getFid(), (byte)mamaMsgType.MAMA_MSG_TYPE_INITIAL); m_msg.addU8("", (ushort)MamaReservedFields.MsgStatus.getFid(), (byte)mamaMsgStatus.MAMA_MSG_STATUS_OK); m_msg.addString("", 11, "TEST STRING"); // MdFeedName Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINE, "Send " + i); try { pub.send(m_msg); } catch (Exception ex) { Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINE, "Exception " + ex.StackTrace); } pub.destroy(); Thread.Sleep(100); } Assert.AreEqual(numPublishes, createCount, "create"); Assert.AreEqual(numPublishes, destroyCount, "destroy"); Assert.AreEqual(numPublishes, errorCount, "error"); }
public void onCreate(MamaPublisher publisher) { createCount++; string subject = publisher.getSource() + "." + publisher.getSymbol(); // test getters Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINE, "MamaPublisherTest.onCreate: " + subject); }
public void onError(MamaPublisher publisher, MamaStatus.mamaStatus status, string topic) { errorCount++; string subject = publisher.getSource() + "." + publisher.getSymbol(); // test getters Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINE, "MamaPublisherTest.onError: " + subject + " status=" + ((int)status)); }
public void onDestroy(MamaPublisher publisher) { // Cannot use publisher object here, its native handle had been destroyed destroyCount++; Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINE, "MamaPublisherTest.onDestroy: "); }