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 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); } }