Example usage for javax.jms BytesMessage writeUTF

List of usage examples for javax.jms BytesMessage writeUTF

Introduction

In this page you can find the example usage for javax.jms BytesMessage writeUTF.

Prototype


void writeUTF(String value) throws JMSException;

Source Link

Document

Writes a string to the bytes message stream using UTF-8 encoding in a machine-independent manner.

Usage

From source file:com.fiorano.openesb.application.application.OutputPortInstance.java

public void toMessage(BytesMessage bytesMessage) throws JMSException {
    super.toMessage(bytesMessage);
    bytesMessage.writeInt(priority);//ww w.  j a  v a2  s .co  m
    bytesMessage.writeUTF(publisherConfigName);
    bytesMessage.writeLong(timeToLive);
    applicationContextTransformation.toMessage(bytesMessage);
}

From source file:com.fiorano.openesb.application.application.InputPortInstance.java

public void toMessage(BytesMessage bytesMessage) throws JMSException {
    super.toMessage(bytesMessage);
    bytesMessage.writeInt(acknowledgementMode);
    bytesMessage.writeUTF(messageSelector);
    bytesMessage.writeInt(sessionCount);
    bytesMessage.writeUTF(subscriberConfigName);
    bytesMessage.writeUTF(subscriptionName);
    bytesMessage.writeInt(transactionSize);
}

From source file:com.chinamobile.bcbsp.comm.ProducerTool.java

/**
 * Send message into messageQueue, update information with serialize method.
 * @param session// w w  w  .j  av  a  2  s . c  o  m
 * @param producer
 * @throws Exception
 *         e
 */
private void sendLoopOptimistic(final Session session, final MessageProducer producer) throws Exception {
    try {
        BSPMessage msg;
        int count = 0;
        int packCounts = messageQueue.size() / this.packSize;
        // LOG.info("send packSize = "+ this.packSize);
        int packCount = 0;
        while (packCount < packCounts) {
            BytesMessage message = session.createBytesMessage();
            long start = System.currentTimeMillis();
            /* Clock */
            message.writeInt(this.packSize);
            count = 0;
            while (count < this.packSize) {
                msg = (BSPMessage) messageQueue.poll();
                // LOG.info(msg.intoString());
                // message.setInt("dstPartition", msg.getDstPartition());
                message.writeInt(msg.getDstPartition());
                // message.writeUTF(msg.getSrcVertexID());
                // message.setString("dstVertexID", msg.getDstVertexID());
                message.writeUTF(msg.getDstVertexID());
                // message.setBytes("tag", msg.getTag());
                message.writeInt(msg.getTag().length);
                message.writeBytes(msg.getTag());
                // message.setBytes("data", msg.getData());
                message.writeInt(msg.getData().length);
                message.writeBytes(msg.getData());
                count++;
                this.messageCount++;
            }
            this.serializeTime += (System.currentTimeMillis() - start);
            /* Clock */
            start = System.currentTimeMillis();
            /* Clock */
            producer.send(message);
            this.sendTime += (System.currentTimeMillis() - start);
            /* Clock */
            packCount++;
            // if (messageCount % 100000 == 0 ){
            // LOG.info("send " + messageCount);
            // }
        }
        // send remaining messags
        int sendSize = messageQueue.size();
        if (sendSize != 0) {
            BytesMessage message = session.createBytesMessage();
            long start = System.currentTimeMillis();
            /* Clock */
            // message.setInt("packSize", sendSize);
            message.writeInt(sendSize);
            while ((msg = (BSPMessage) messageQueue.poll()) != null) {
                // message.setInt("dstPartition", msg.getDstPartition());
                message.writeInt(msg.getDstPartition());
                // message.setString("dstVertexID", msg.getDstVertexID());
                message.writeUTF(msg.getDstVertexID());
                // message.setBytes("tag", msg.getTag());
                message.writeInt(msg.getTag().length);
                message.writeBytes(msg.getTag());
                // message.setBytes("data", msg.getData());
                message.writeInt(msg.getData().length);
                message.writeBytes(msg.getData());
                this.messageCount++;
            }
            this.serializeTime += (System.currentTimeMillis() - start);
            /* Clock */
            start = System.currentTimeMillis();
            /* Clock */
            producer.send(message);
            this.sendTime += (System.currentTimeMillis() - start);
            /* Clock */
        }
    } catch (Exception e) {
        LOG.error("[ProducerTool] send loop ", e);
    }
}

From source file:com.fiorano.openesb.application.application.PortInstance.java

public void toMessage(BytesMessage bytesMessage) throws JMSException {
    super.toMessage(bytesMessage);
    bytesMessage.writeUTF(appContextAction);
    bytesMessage.writeUTF(clientID);/*  www  .j av a2  s . c  o  m*/
    bytesMessage.writeInt(destinationType);
    bytesMessage.writeUTF(destination);
    bytesMessage.writeUTF(destinationConfigName);
    bytesMessage.writeUTF(encryptionAlgorithm);
    bytesMessage.writeUTF(encryptionKey);
    bytesMessage.writeUTF(initializationVector);
    bytesMessage.writeBoolean(isMessageFilterSet);
    bytesMessage.writeUTF(messageFilterConfigName);
    if (messageFilters == null) {
        bytesMessage.writeInt(-1);
    } else {
        bytesMessage.writeInt(messageFilters.size());
        for (Object configKey : messageFilters.keySet()) {
            bytesMessage.writeUTF((String) configKey);
            bytesMessage.writeUTF((String) messageFilters.get(configKey));
        }
    }
    bytesMessage.writeUTF(password);
    bytesMessage.writeUTF(user);
    bytesMessage.writeUTF(proxyPassword);
    bytesMessage.writeUTF(proxyURL);
    bytesMessage.writeUTF(proxyUser);
    bytesMessage.writeUTF(securityManager);
}