ActiveMQ Artemis send message without creating producer connection

59 Views Asked by At

Is there any solution to send message to ActiveMQ Artemis queue without creating producer? I want to send byte message via consumer connection.

There is a QueueControlImpl class but for send byte message it must be encoded, and I don't want to encode message.

Object queueControlObj = server.getManagementService().getResource(ResourceNames.QUEUE + queueName);
QueueControlImpl queueControl = ((QueueControlImpl) queueControlObj);
String msg = Base64.encodeBytes(message.getBytes(StandardCharsets.UTF_8));
queueControl.sendMessage(null, Message.BYTES_TYPE, String.valueOf(bytesMessage), false, "", "");

I hope to find a solution to send a message to a Destination without creating new connection for the producer.

1

There are 1 best solutions below

0
fereshte On

Thank you Justin for your valuable tips. My main problem was not creating a new connection for the producer to reduce the load on the network. Since I'm using Embedded ActiveMQ Artemis, Justin suggested using in-vm connections.