Брокер А.Когда ActiveMQ networkconnector садилось, тема сообщения истек
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="mqtt_1" dataDirectory="${activemq.data}" persistent="true" schedulePeriodForDestinationPurge="13000" offlineDurableSubscriberTimeout="90000" offlineDurableSubscriberTaskSchedule="20000" useJmx="true">
</broker>
Брокер Б.
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="mqtt_2" dataDirectory="${activemq.data}" persistent="true" schedulePeriodForDestinationPurge="13000" offlineDurableSubscriberTimeout="90000" offlineDurableSubscriberTaskSchedule="20000" useJmx="true">
<networkConnectors>
<networkConnector
name="mqtt_2"
uri="static:(tcp://BrokerA IP:61616)"
conduitSubscriptions="false"
dynamicOnly="true"
prefetchSize="1"
networkTTL="1"
messageTTL="1"
consumerTTL="1"
/>
</networkConnectors> </broker>
Абонент был подключен брокер А. я публикую сообщение для Broker B.
String url = "tcp://Broker B IP:61616";
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
TopicConnection tpConnection = connectionFactory.createTopicConnection();
tpConnection.start();
TopicSession tpSession = tpConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = tpSession.createTopic("a/b/c/e");
TopicPublisher topicPublisher = tpSession.createPublisher(topic);
topicPublisher.setTimeToLive(5000);
MapMessage map = tpSession.createMapMessage();
map.setString("test", "value");
topicPublisher.publish(map);
tpConnection.stop();
topicPublisher.close();
tpSession.close();
tpConnection.close();
Но, как только опубликовано сообщение для Брокер B, Сообщение было истекло
2015-01-23 16: 51: 41,930 | DEBUG | Сообщение истек ActiveMQMapMessage {commandId = 6, responseRequired = верно, MessageId = ID: test.local-50762-1421999415422-1: 1: 1: 1: 1, originalDestination = NULL, originalTransactionId = NULL, producerId = ID: test.local-50762-1421999415422-1: 1: 1: 1, destination = topic: // abce, transactionId = null, expiration = 1421999420843, timestamp = 1421999415843, arrival = 0, brokerInTime = 1421999501929, brokerOutTime = 0 , correId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compression = false, userID = null, content = org.apache. [email protected], marshalledProperties =нуль, структура данных = NULL, redeliveryCounter = 0, размер = 0, свойства = NULL, readOnlyProperties = ложь, readOnlyBody = ложь, Droppable = ложь, jmsXGroupFirstForConsumer = ложь} ActiveMQMapMessage {= {таблицы, с}} | org.apache.activemq.broker.region.RegionBroker | ActiveMQ Транспорт: ТСР: ///xxx.xxx.xxx.xxx: 50763 @ 61616
После этого кода ('topicPublisher.setTimeToLive (5000);') был снят, успех. Почему этот код является проблемой?
Как только опубликовать сообщение для Broker B, сообщение истек. – iamssin