public void onMsg( MamaSubscription subscription, MamaMsg msg) { mamaMsgType msgType = msg.typeForMsg(); mamaMsgStatus msgStatus = msg.getStatus(); switch (msgType) { case mamaMsgType.MAMA_MSG_TYPE_DELETE: case mamaMsgType.MAMA_MSG_TYPE_EXPIRE: subscription.deallocate(); return; } switch (msgStatus) { case mamaMsgStatus.MAMA_MSG_STATUS_BAD_SYMBOL: case mamaMsgStatus.MAMA_MSG_STATUS_EXPIRED: case mamaMsgStatus.MAMA_MSG_STATUS_TIMEOUT: subscription.deallocate(); return; } for (int i=0;i<mSubscription.mMsgListeners.Count;i++) { MamdaMsgListener listener = (MamdaMsgListener) mSubscription.mMsgListeners[i]; listener.onMsg(mSubscription, msg, msgType); } }
public void onMsg(MamaSubscription subscription, MamaMsg msg) { // Create a field callback class to display the field contents ListenerFieldCallback fieldCallback = new ListenerFieldCallback(m_dictionary, m_iterator, m_quietness); if (m_quietness < 2) { Console.WriteLine(subscription.subscSource + "." + subscription.subscSymbol + " TYPE: " + msg.getType() + " Status: " + msg.getStatus()); } if (m_quietness < 1) { if (m_iterator) { // Set the iterator to the beginning of the message msg.begin(ref m_messageIterator); // Keep going until there are no more fields MamaMsgField field = m_messageIterator.getField(); while (field != null) { // Display the field fieldCallback.displayField(field, 0); m_messageIterator++; // Get the next field field = m_messageIterator.getField(); } } else { // Otherwise use the iteration function on the message itself int indentlevel = 0; msg.iterateFields(fieldCallback, m_dictionary, indentlevel); } } }