Esempio n. 1
0
        } // Logger

        public int OnReceive(object cbArg, LBMMessage msg)
        {
            TmonConnection conn = (TmonConnection)msg.sourceClientObject();

            if (conn != null)
            {
                conn.ReceiverEvent(msg);
            }

            switch (msg.type())
            {
            case LBM.MSG_DATA:
                MyLog("app_rcv_callback: LBM_MSG_DATA: "
                      + (long)msg.length() + " bytes on topic " + msg.topicName() + ":"
                      + msg.dataString());

                _messagesReceived++;
                break;

            case LBM.MSG_BOS:
                MyLog("app_rcv_callback: LBM_MSG_BOS: ["
                      + msg.topicName() + "][" + msg.source() + "]");
                break;

            case LBM.MSG_EOS:
                MyLog("app_rcv_callback: LBM_MSG_EOS: ["
                      + msg.topicName() + "][" + msg.source() + "]");
                _messagesReceived++;
                break;

            case LBM.MSG_UNRECOVERABLE_LOSS:
                MyLog("app_rcv_callback: LBM_MSG_UNRECOVERABLE_LOSS: ["
                      + msg.topicName() + "][" + msg.source() + "]");
                _messagesReceived++;
                break;

            case LBM.MSG_UNRECOVERABLE_LOSS_BURST:
                MyLog("app_rcv_callback: LBM_MSG_UNRECOVERABLE_LOSS_BURST: ["
                      + msg.topicName() + "][" + msg.source() + "]");
                _messagesReceived++;
                break;

            default: // Unexpected receiver event.
                MyLog("app_rcv_callback: default: ["
                      + msg.topicName() + "][" + msg.source() + "], type=" + msg.type());
                break;
            } // switch

            return(0);
        } // OnReceive