use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class GeneralInteropTest method sendStreamMessageUsingOpenWire.
private void sendStreamMessageUsingOpenWire(String queueName) throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
System.out.println("destination: " + destination);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
StreamMessage streamMessage = session.createStreamMessage();
streamMessage.writeBoolean(true);
streamMessage.writeByte((byte) 2);
streamMessage.writeBytes(new byte[] { 6, 7 });
streamMessage.writeChar('b');
streamMessage.writeDouble(6.5);
streamMessage.writeFloat((float) 93.9);
streamMessage.writeInt(7657);
streamMessage.writeLong(239999L);
streamMessage.writeShort((short) 34222);
streamMessage.writeString("hello streammessage");
producer.send(streamMessage);
}
use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class GeneralInteropTest method sendTextMessageUsingOpenWire.
private void sendTextMessageUsingOpenWire(String text) throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
TextMessage textMessage = session.createTextMessage(text);
producer.send(textMessage);
}
use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class CompressedInteropTest method sendCompressedStreamMessageUsingOpenWire.
private void sendCompressedStreamMessageUsingOpenWire() throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
StreamMessage streamMessage = session.createStreamMessage();
streamMessage.writeBoolean(true);
streamMessage.writeByte((byte) 10);
streamMessage.writeBytes(TEXT.getBytes());
streamMessage.writeChar('A');
streamMessage.writeDouble(55.3D);
streamMessage.writeFloat(79.1F);
streamMessage.writeInt(37);
streamMessage.writeLong(56652L);
streamMessage.writeObject(new String("VVVV"));
streamMessage.writeShort((short) 333);
streamMessage.writeString(TEXT);
producer.send(streamMessage);
}
use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class CompressedInteropTest method sendCompressedBytesMessageUsingOpenWire.
private void sendCompressedBytesMessageUsingOpenWire() throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
BytesMessage bytesMessage = session.createBytesMessage();
bytesMessage.writeBytes(TEXT.getBytes());
producer.send(bytesMessage);
}
use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class CompressedInteropTest method sendCompressedMapMessageUsingOpenWire.
private void sendCompressedMapMessageUsingOpenWire() throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
MapMessage mapMessage = session.createMapMessage();
mapMessage.setBoolean("boolean-type", true);
mapMessage.setByte("byte-type", (byte) 10);
mapMessage.setBytes("bytes-type", TEXT.getBytes());
mapMessage.setChar("char-type", 'A');
mapMessage.setDouble("double-type", 55.3D);
mapMessage.setFloat("float-type", 79.1F);
mapMessage.setInt("int-type", 37);
mapMessage.setLong("long-type", 56652L);
mapMessage.setObject("object-type", new String("VVVV"));
mapMessage.setShort("short-type", (short) 333);
mapMessage.setString("string-type", TEXT);
producer.send(mapMessage);
}
Aggregations