Example usage for javax.jms BytesMessage readInt

List of usage examples for javax.jms BytesMessage readInt

Introduction

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

Prototype


int readInt() throws JMSException;

Source Link

Document

Reads a signed 32-bit integer from the bytes message stream.

Usage

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

public void fromMessage(BytesMessage bytesMessage) throws JMSException {
    super.fromMessage(bytesMessage);
    priority = bytesMessage.readInt();
    publisherConfigName = bytesMessage.readUTF();
    timeToLive = bytesMessage.readLong();
    applicationContextTransformation = new Transformation();
    applicationContextTransformation.fromMessage(bytesMessage);
}

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

public void fromMessage(BytesMessage bytesMessage) throws JMSException {
    super.fromMessage(bytesMessage);
    acknowledgementMode = bytesMessage.readInt();
    messageSelector = bytesMessage.readUTF();
    sessionCount = bytesMessage.readInt();
    subscriberConfigName = bytesMessage.readUTF();
    subscriptionName = bytesMessage.readUTF();
    transactionSize = bytesMessage.readInt();
}

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

/**
 * Put message into messageQueue with serialize method.
 *//*w ww .j  ava 2 s.  c  om*/
public void onMessageOptimistic(Message message) throws IOException {
    messagesReceived++;
    try {
        if (message instanceof BytesMessage) {
            BytesMessage mapMsg = (BytesMessage) message;
            BSPMessage bspMsg;
            int packSize = mapMsg.readInt();
            int count = 0;
            int partitionID;
            String srcVertexID;
            String dstVertexID;
            byte[] tag;
            byte[] data;
            int tagLen;
            int dataLen;
            while (count < packSize) {
                partitionID = mapMsg.readInt();
                dstVertexID = mapMsg.readUTF();
                tagLen = mapMsg.readInt();
                tag = new byte[tagLen];
                mapMsg.readBytes(tag);
                dataLen = mapMsg.readInt();
                data = new byte[dataLen];
                mapMsg.readBytes(data);
                // bspMsg = new BSPMessage(partitionID, dstVertexID, tag, data);
                // dst is message if it is not null.
                bspMsg = new BSPMessage(partitionID, dstVertexID, tag, data);
                this.messageQueues.incomeAMessage(dstVertexID, bspMsg);
                this.messageCount++;
                this.messageBytesCount += bspMsg.size();
                count++;
            }
        } else {
            // Message received is not ObjectMessage.
            LOG.error("[ConsumerTool] Message received is not BytesMessage!");
        }
        if (message.getJMSReplyTo() != null) {
            replyProducer.send(message.getJMSReplyTo(),
                    session.createTextMessage("Reply: " + message.getJMSMessageID()));
        }
        if (transacted) {
            if ((messagesReceived % batch) == 0) {
                LOG.info("Commiting transaction for last " + batch + " messages; messages so far = "
                        + messagesReceived);
                session.commit();
            }
        } else if (ackMode == Session.CLIENT_ACKNOWLEDGE) {
            if ((messagesReceived % batch) == 0) {
                LOG.info("Acknowledging last " + batch + " messages; messages so far = " + messagesReceived);
                message.acknowledge();
            }
        }
    } catch (JMSException e) {
        LOG.error("[ConsumerTool] caught: ", e);
    } finally {
        if (sleepTime > 0) {
            try {
                Thread.sleep(sleepTime);
            } catch (InterruptedException e) {
                LOG.error("[ConsumerTool] caught: ", e);
            }
        }
    }
}

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

public void fromMessage(BytesMessage bytesMessage) throws JMSException {
    super.fromMessage(bytesMessage);
    appContextAction = bytesMessage.readUTF();
    clientID = bytesMessage.readUTF();/*  w  ww.  j  a  v a  2s  . c o m*/
    destinationType = bytesMessage.readInt();
    destination = bytesMessage.readUTF();
    destinationConfigName = bytesMessage.readUTF();
    encryptionAlgorithm = bytesMessage.readUTF();
    encryptionKey = bytesMessage.readUTF();
    initializationVector = bytesMessage.readUTF();
    isMessageFilterSet = bytesMessage.readBoolean();
    messageFilterConfigName = bytesMessage.readUTF();

    int numConfigs = bytesMessage.readInt();
    if (numConfigs > 0) {
        messageFilters = new HashMap<>();
        for (int i = 0; i < numConfigs; i++) {
            String key = bytesMessage.readUTF();
            String config = bytesMessage.readUTF();
            messageFilters.put(key, config);
        }
    }
    password = bytesMessage.readUTF();
    user = bytesMessage.readUTF();
    proxyPassword = bytesMessage.readUTF();
    proxyURL = bytesMessage.readUTF();
    proxyUser = bytesMessage.readUTF();
    securityManager = bytesMessage.readUTF();
}