Search in sources :

Example 16 with TextMessageImpl

use of com.swiftmq.jms.TextMessageImpl in project swiftmq-ce by iitsoftware.

the class SessionStore method add.

public synchronized void add(String clientid, MQTTSession session) throws Exception {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(ctx.mqttSwiftlet.getName(), toString() + ", add, clientid=" + clientid);
    QueueSender sender = ctx.queueManager.createQueueSender(STORE_QUEUE, null);
    QueuePushTransaction t = sender.createTransaction();
    TextMessageImpl message = new TextMessageImpl();
    message.setJMSDestination(new QueueImpl(STORE_QUEUE));
    message.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
    message.setJMSPriority(Message.DEFAULT_PRIORITY);
    message.setJMSExpiration(Message.DEFAULT_TIME_TO_LIVE);
    message.setJMSMessageID(MSGID + IdGenerator.getInstance().nextId('/'));
    message.setStringProperty(PROP_CLIENTID, clientid);
    message.setText(xStream.toXML(session.getSessionStoreEntry()));
    t.putMessage(message);
    t.commit();
    sender.close();
}
Also used : TextMessageImpl(com.swiftmq.jms.TextMessageImpl) QueueImpl(com.swiftmq.jms.QueueImpl)

Example 17 with TextMessageImpl

use of com.swiftmq.jms.TextMessageImpl in project swiftmq-client by iitsoftware.

the class FileQueryPropsRequest method toMessage.

public Message toMessage() throws JMSException {
    TextMessage message = new TextMessageImpl();
    message.setIntProperty(ProtocolFactory.DUMPID_PROP, ProtocolFactory.FILEQUERYPROPS_REQ);
    if (link != null)
        message.setStringProperty(LINK_PROP, link);
    fillMessage(message);
    message.setText(selector);
    return message;
}
Also used : TextMessageImpl(com.swiftmq.jms.TextMessageImpl) TextMessage(javax.jms.TextMessage)

Example 18 with TextMessageImpl

use of com.swiftmq.jms.TextMessageImpl in project swiftmq-client by iitsoftware.

the class SessionCloseRequest method toMessage.

public Message toMessage() throws JMSException {
    TextMessage message = new TextMessageImpl();
    fillMessage(message);
    message.setIntProperty(ProtocolFactory.DUMPID_PROP, ProtocolFactory.SESSIONCLOSE_REQ);
    return message;
}
Also used : TextMessageImpl(com.swiftmq.jms.TextMessageImpl) TextMessage(javax.jms.TextMessage)

Aggregations

TextMessageImpl (com.swiftmq.jms.TextMessageImpl)18 TextMessage (javax.jms.TextMessage)12 ContentHeaderProperties (com.swiftmq.amqp.v091.types.ContentHeaderProperties)2 BytesMessageImpl (com.swiftmq.jms.BytesMessageImpl)2 MessageImpl (com.swiftmq.jms.MessageImpl)2 QueueImpl (com.swiftmq.jms.QueueImpl)2 HashMap (java.util.HashMap)2 JMSException (javax.jms.JMSException)2 Field (com.swiftmq.amqp.v091.types.Field)1 Delivery (com.swiftmq.impl.amqp.amqp.v00_09_01.Delivery)1 XStream (com.thoughtworks.xstream.XStream)1 Dom4JDriver (com.thoughtworks.xstream.io.xml.Dom4JDriver)1 StringWriter (java.io.StringWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Enumeration (java.util.Enumeration)1 Destination (javax.jms.Destination)1