gpt4 book ai didi

java - JMS。在 WildFly 12 中向 ActiveMQ 中的主题发送简单的主题消息失败

转载 作者:太空宇宙 更新时间:2023-11-04 10:28:51 25 4
gpt4 key购买 nike

我想将一个简单主题发布到主题队列。因此,我在 WildFly 12 中使用 ActivMQ-Extension(在子系统下)。但我收到以下错误:

CompletionListener/SendAcknowledgementHandler used with confirmationWindowSize=-1. Enable confirmationWindowSize to receive acks from server!

这是什么意思?我使用以下代码:

@RequestScoped
public class Sender {

@Resource(lookup = "java:jboss/exported/jms/RemoteConnectionFactory")
private ConnectionFactory connectionFactory;

@Resource(lookup = "java:jboss/jms/queue/bookstoreqeue")
private Queue queue;

@Resource(lookup = "java:jboss/jms/messagetopic")
private Topic topic;


public void send() throws JMSException {
Connection connection = connectionFactory.createConnection("admin", "admin");

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

MessageProducer messageProducer = session.createProducer(topic);

TextMessage message = session.createTextMessage("message");


MessageConsumer consumer = session.createConsumer(topic);
consumer.setMessageListener(msg -> System.out.println("Received!"));


while (true) {

try {
TimeUnit.SECONDS.sleep(5);
messageProducer.send(message, new CompletionListener() {
@Override
public void onCompletion(Message message) {
System.out.println("complete!");
}

@Override
public void onException(Message message, Exception exception) {
System.out.println(exception);
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

我知道我的 MessageProducer 正在将主题发送到 TopicQueue 并且有一个订阅者:

enter image description here

这可能是什么问题?顺便说一句,同样的错误出现在队列和主题上......

最佳答案

尝试在连接工厂设置中更新确认窗口大小

关于java - JMS。在 WildFly 12 中向 ActiveMQ 中的主题发送简单的主题消息失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50280156/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com