Search in sources :

Example 16 with ByteSequence

use of org.apache.activemq.util.ByteSequence in project activemq-artemis by apache.

the class OpenWireConnection method physicalSend.

public void physicalSend(Command command) throws IOException {
    if (logger.isTraceEnabled()) {
        tracePhysicalSend(transportConnection, command);
    }
    try {
        final ByteSequence bytes = outWireFormat.marshal(command);
        final int bufferSize = bytes.length;
        final ActiveMQBuffer buffer = transportConnection.createTransportBuffer(bufferSize);
        buffer.writeBytes(bytes.data, bytes.offset, bufferSize);
        transportConnection.write(buffer, false, false);
        bufferSent();
    } catch (IOException e) {
        throw e;
    } catch (Throwable t) {
        ActiveMQServerLogger.LOGGER.error("error sending", t);
    }
}
Also used : IOException(java.io.IOException) ByteSequence(org.apache.activemq.util.ByteSequence) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer)

Example 17 with ByteSequence

use of org.apache.activemq.util.ByteSequence in project activemq-artemis by apache.

the class OpenWireMessageConverter method putMsgOriginalDestination.

private static void putMsgOriginalDestination(final ActiveMQDestination origDest, final WireFormat marshaller, final CoreMessage coreMessage) throws IOException {
    final ByteSequence origDestBytes = marshaller.marshal(origDest);
    origDestBytes.compact();
    coreMessage.putBytesProperty(AMQ_MSG_ORIG_DESTINATION, origDestBytes.data);
}
Also used : ByteSequence(org.apache.activemq.util.ByteSequence)

Example 18 with ByteSequence

use of org.apache.activemq.util.ByteSequence in project activemq-artemis by apache.

the class OpenWireMessageConverter method setAMQMsgOriginalTransactionId.

private static void setAMQMsgOriginalTransactionId(final ActiveMQMessage amqMsg, final WireFormat marshaller, final byte[] origTxIdBytes) throws IOException {
    TransactionId origTxId = (TransactionId) marshaller.unmarshal(new ByteSequence(origTxIdBytes));
    amqMsg.setOriginalTransactionId(origTxId);
}
Also used : ByteSequence(org.apache.activemq.util.ByteSequence) TransactionId(org.apache.activemq.command.TransactionId)

Example 19 with ByteSequence

use of org.apache.activemq.util.ByteSequence in project activemq-artemis by apache.

the class OpenWireMessageConverter method setAMQMsgDataStructure.

private static void setAMQMsgDataStructure(final ActiveMQMessage amqMsg, final WireFormat marshaller, final byte[] dsBytes) throws IOException {
    ByteSequence seq = new ByteSequence(dsBytes);
    DataStructure ds = (DataStructure) marshaller.unmarshal(seq);
    amqMsg.setDataStructure(ds);
}
Also used : DataStructure(org.apache.activemq.command.DataStructure) ByteSequence(org.apache.activemq.util.ByteSequence)

Example 20 with ByteSequence

use of org.apache.activemq.util.ByteSequence in project activemq-artemis by apache.

the class OpenWireMessageConverter method putMsgReplyTo.

private static void putMsgReplyTo(final ActiveMQDestination replyTo, final WireFormat marshaller, final CoreMessage coreMessage) throws IOException {
    final ByteSequence replyToBytes = marshaller.marshal(replyTo);
    replyToBytes.compact();
    coreMessage.putBytesProperty(AMQ_MSG_REPLY_TO, replyToBytes.data);
}
Also used : ByteSequence(org.apache.activemq.util.ByteSequence)

Aggregations

ByteSequence (org.apache.activemq.util.ByteSequence)31 Test (org.junit.Test)13 CountDownLatch (java.util.concurrent.CountDownLatch)6 File (java.io.File)4 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)4 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)3 ArrayList (java.util.ArrayList)2 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)2 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)2 DataStructure (org.apache.activemq.command.DataStructure)2 MessageId (org.apache.activemq.command.MessageId)2 ProducerId (org.apache.activemq.command.ProducerId)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 Calendar (java.util.Calendar)1 Deflater (java.util.zip.Deflater)1 MessageConsumer (javax.jms.MessageConsumer)1 Session (javax.jms.Session)1 ActiveMQConnection (org.apache.activemq.ActiveMQConnection)1 ICoreMessage (org.apache.activemq.artemis.api.core.ICoreMessage)1