use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class GeneralInteropTest method sendBytesMessageUsingOpenWire.
private void sendBytesMessageUsingOpenWire(byte[] bytesData) 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);
BytesMessage bytesMessage = session.createBytesMessage();
bytesMessage.writeBytes(bytesData);
bytesMessage.writeBoolean(true);
bytesMessage.writeLong(99999L);
bytesMessage.writeChar('h');
bytesMessage.writeInt(987);
bytesMessage.writeShort((short) 1099);
bytesMessage.writeUTF("hellobytes");
producer.send(bytesMessage);
}
use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class GeneralInteropTest method sendObjectMessageUsingOpenWire.
private void sendObjectMessageUsingOpenWire(SimpleSerializable obj) 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);
ObjectMessage objectMessage = session.createObjectMessage(obj);
producer.send(objectMessage);
}
use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class GeneralInteropTest method sendMultipleTextMessagesUsingOpenWire.
private void sendMultipleTextMessagesUsingOpenWire(String text, int num) throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
for (int i = 0; i < num; i++) {
TextMessage textMessage = session.createTextMessage(text + i);
producer.send(textMessage);
}
}
use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class GeneralInteropTest method sendMapMessageUsingOpenWire.
private void sendMapMessageUsingOpenWire() 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);
MapMessage mapMessage = session.createMapMessage();
mapMessage.setBoolean("aboolean", true);
mapMessage.setByte("abyte", (byte) 4);
mapMessage.setBytes("abytes", new byte[] { 4, 5 });
mapMessage.setChar("achar", 'a');
mapMessage.setDouble("adouble", 4.4);
mapMessage.setFloat("afloat", 4.5f);
mapMessage.setInt("aint", 40);
mapMessage.setLong("along", 80L);
mapMessage.setShort("ashort", (short) 65);
mapMessage.setString("astring", "hello");
producer.send(mapMessage);
}
use of org.apache.activemq.ActiveMQMessageProducer in project activemq-artemis by apache.
the class GeneralInteropTest method sendMessageUsingOpenWire.
private void sendMessageUsingOpenWire(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);
javax.jms.Message message = session.createMessage();
message.setBooleanProperty("booleanProperty", false);
message.setLongProperty("longProperty", 99999L);
message.setByteProperty("byteProperty", (byte) 5);
message.setIntProperty("intProperty", 979);
message.setShortProperty("shortProperty", (short) 1099);
message.setStringProperty("stringProperty", "HelloMessage");
producer.send(message);
}
Aggregations