ActiveMQ Artemis 发送消息而不创建生产者连接

问题描述 投票:0回答:1

有没有什么解决方案可以在不创建生产者的情况下将消息发送到ActiveMQ Artemis队列?我想通过消费者连接发送字节消息。

有一个

QueueControlImpl
类,但对于发送字节消息,必须对其进行编码,而我不想对消息进行编码。

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, "", "");

我希望找到一种解决方案,可以在不为生产者创建新连接的情况下向目的地发送消息。

producer-consumer activemq-artemis
1个回答
0
投票

感谢贾斯汀提供的宝贵建议。我的主要问题不是为生产者创建新连接以减少网络负载。由于我使用的是

Embedded ActiveMQ Artemis
,Justin 建议使用
in-vm connections

© www.soinside.com 2019 - 2024. All rights reserved.