【发布时间】:2019-01-27 07:12:47
【问题描述】:
我的接收器没有收到持久性消息。 如果接收者在线并且我正在发送消息,那么它正在接收消息,但如果我不在线(未连接到 activeMQ),那么我在发送消息后发送消息我连接到 activeMQ。在这种情况下,我没有收到消息。 这是我的接收者代码。
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(Constants.USER_NAME,
Constants.PASSWORD,Constants.BROKER_URL);
connectionFactory.setTrustAllPackages(true);
connection = connectionFactory.createConnection();
connection.setClientID(Utility.getIMEINumber(context));
connection.start();
Topic destination = new ActiveMQTopic(Constants.TOPIC_NAME);
Session receiverSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
receiverSession.createDurableSubscriber(destination,Utility.getIMEINumber(context));
MessageConsumer receiver = receiverSession.createConsumer(destination);
我的发件人代码如下
jmsTemplateTopic.convertAndSend(objectMessage);
jms 主题配置了持久化传递
【问题讨论】:
-
在发送消息之前,持久订阅者是否至少连接过一次?
-
是的。首先我连接然后断开连接。
标签: android jms activemq jms-topic