Search in sources :

Example 1 with NullMessage

use of com.generallycloud.baseio.container.jms.NullMessage in project baseio by generallycloud.

the class FixedMessageConsumer method onReceive.

@Override
public void onReceive(Message message) {
    int msgType = message.getMsgType();
    if (Message.TYPE_MAP == msgType) {
        MapMessage m = (MapMessage) message;
        String eventName = m.getParameter("eventName");
        OnMappedMessage onMessage = onMappedMessages.get(eventName);
        if (onMessage == null) {
            return;
        }
        onMessage.onReceive(m);
    } else if (Message.TYPE_MAP_BYTE == msgType) {
        MapByteMessage m = (MapByteMessage) message;
        String eventName = m.getParameter("eventName");
        OnMappedMessage onMessage = onMappedMessages.get(eventName);
        if (onMessage == null) {
            return;
        }
        onMessage.onReceive(m);
    } else if (Message.TYPE_TEXT == msgType) {
        if (onTextMessage != null) {
            onTextMessage.onReceive((TextMessage) message);
        }
    } else if (Message.TYPE_TEXT_BYTE == msgType) {
        if (onTextByteMessage != null) {
            onTextByteMessage.onReceive((TextByteMessage) message);
        }
    } else if (Message.TYPE_ERROR == msgType) {
        if (onErrorMessage != null) {
            onErrorMessage.onReceive((ErrorMessage) message);
        }
    } else if (Message.TYPE_NULL == msgType) {
        if (onNullMessage != null) {
            onNullMessage.onReceive((NullMessage) message);
        }
    }
}
Also used : TextByteMessage(com.generallycloud.baseio.container.jms.TextByteMessage) NullMessage(com.generallycloud.baseio.container.jms.NullMessage) MapMessage(com.generallycloud.baseio.container.jms.MapMessage) MapByteMessage(com.generallycloud.baseio.container.jms.MapByteMessage)

Aggregations

MapByteMessage (com.generallycloud.baseio.container.jms.MapByteMessage)1 MapMessage (com.generallycloud.baseio.container.jms.MapMessage)1 NullMessage (com.generallycloud.baseio.container.jms.NullMessage)1 TextByteMessage (com.generallycloud.baseio.container.jms.TextByteMessage)1