Search in sources :

Example 1 with POSendMessage

use of com.swiftmq.impl.mqtt.po.POSendMessage in project swiftmq-ce by iitsoftware.

the class Subscription method processMessage.

@Override
public void processMessage(MessageEntry messageEntry) {
    try {
        QueuePullTransaction tx = consumer.createTransaction();
        tx.moveToTransaction(messageEntry.getMessageIndex(), readTx);
        String jmsTopicName = ((TopicImpl) messageEntry.getMessage().getJMSDestination()).getTopicName();
        MqttQoS mqos = MqttQoS.valueOf(qos.value());
        if (messageEntry.getMessage().propertyExists(Producer.PROP_QOS)) {
            int pqos = messageEntry.getMessage().getIntProperty(Producer.PROP_QOS);
            int sqos = qos.value();
            if (sqos > pqos)
                mqos = MqttQoS.valueOf(pqos);
        }
        session.getMqttConnection().getConnectionQueue().enqueue(new POSendMessage(jmsTopicName, messageEntry.getMessage(), mqos, tx, this));
        incMsgsReceived(1);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : POSendMessage(com.swiftmq.impl.mqtt.po.POSendMessage) QueuePullTransaction(com.swiftmq.swiftlet.queue.QueuePullTransaction) TopicImpl(com.swiftmq.jms.TopicImpl) MqttQoS(com.swiftmq.impl.mqtt.v311.netty.handler.codec.mqtt.MqttQoS)

Aggregations

POSendMessage (com.swiftmq.impl.mqtt.po.POSendMessage)1 MqttQoS (com.swiftmq.impl.mqtt.v311.netty.handler.codec.mqtt.MqttQoS)1 TopicImpl (com.swiftmq.jms.TopicImpl)1 QueuePullTransaction (com.swiftmq.swiftlet.queue.QueuePullTransaction)1