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); } }
/// <summary> /// Add a listener for regular messages. /// </summary> /// <param name="listener"></param> public void addMsgListener(MamdaMsgListener listener) { if (!mMsgListeners.Contains(listener)) { mMsgListeners.Add(listener); } }
/// <summary> /// Add a specialized message listener (e.g., a MamdaQuoteListener, /// MamdaTradeListener, etc.) for a participant. /// /// Multiple listeners for each participant can be added. /// </summary> /// <param name="listener">Concrete instance of the MamdaMsgListener interface.</param> /// <param name="partId">The participant id for the instrument.</param> public void addParticipantListener( MamdaMsgListener listener, string partId) { ParticipantInfo participantInfo = getParticipantInfo(partId); participantInfo.mParticipantListeners.Add(listener); }
public void callMamdaOnMsg(MamdaSubscription sub, MamaMsg msg) { try { ArrayList msgListeners = new ArrayList(); msgListeners = sub.getMsgListeners(); IEnumerator iter = msgListeners.GetEnumerator(); int size = msgListeners.Count; for (int i = 0; i < size; i++) { iter.MoveNext(); MamdaMsgListener listener = (MamdaMsgListener)iter.Current; listener.onMsg(sub, msg, msg.getType()); } } catch (Exception ex) { throw new MamdaDataException(ex.Message, ex); } }
/// <summary> /// Add a specialized message listener (e.g. a MamdaQuoteListener, /// MamdaTradeListener, etc.) for a security. /// /// Multiple listeners for each security can be added. /// </summary> /// <param name="listener">Concrete instance of the MamdaMsgListener interface.</param> /// <param name="symbol">The symbol for the instrument. </param> public void addListener( MamdaMsgListener listener, string symbol) { ((ArrayList)mListeners.valueOf(symbol)).Add(listener); }
/// <summary> /// Add a specialized message listener (e.g., a MamdaQuoteListener, /// MamdaTradeListener, etc.) for the consolidated data. /// /// Multiple listeners can be added. /// </summary> /// <param name="listener">Concrete instance of the MamdaMsgListener interface.</param> public void addConsolidatedListener(MamdaMsgListener listener) { mConsolidatedListeners.Add(listener); }