You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2014/11/03 18:40:34 UTC
[jira] [Closed] (AMQ-5410) Out of order messages received in MQTT
network of brokers
[ https://issues.apache.org/jira/browse/AMQ-5410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timothy Bish closed AMQ-5410.
-----------------------------
Resolution: Not a Problem
This is not an issue with the broker, for architecture questions please ask on the users mailing list.
> Out of order messages received in MQTT network of brokers
> ---------------------------------------------------------
>
> Key: AMQ-5410
> URL: https://issues.apache.org/jira/browse/AMQ-5410
> Project: ActiveMQ
> Issue Type: Bug
> Components: MQTT
> Affects Versions: 5.11.0
> Reporter: Netlancer
>
> broker network setup with mqtt enabled.
> scenario:
> Client (C1) connects to MQ1
> C1 publishes message M1 to topic T1
> C1 receives the message M1 by doing receive using mqtt client.
> C1 publishes message M2,M3 to topic T1 and disconnects.
> C1 connects back to MQ2
> C1 does a receive. Now M3 is received first instead of M2.
> The following testcase shows the issues. The testcase is part of activemq-unit-tests/src/test/java/org/apache/activemq/network/MQTTNetworkOfBrokersFailoverTest.java
> {code:title=MQTTNetworkOfBrokersFailoverTest.java|borderStyle=solid}
> @Test
> public void testOutOfOrderMessageScenario() throws Exception{
> // A Consumer subscribing to an topic and Publishing to the same topic receives the messages out of order
> // and some messages lost
> // after failing over and connecting to other broker
> CountDownLatch consumerNetworked = listenForConsumersOn(broker);
> MQTT localMqtt = createMQTTTcpConnection("foo", false, localBrokerMQTTPort);
> BlockingConnection localConn = localMqtt.blockingConnection();
> localConn.connect();
> localConn.subscribe(new Topic[]{new Topic("foo/bar", QoS.EXACTLY_ONCE)});
> String msg = "Hello, World!";
> localConn.publish("foo/bar", msg.getBytes(), QoS.EXACTLY_ONCE, false);
> localConn.publish("foo/bar", "2".getBytes(), QoS.EXACTLY_ONCE, false);
> localConn.publish("foo/bar", "3".getBytes(), QoS.EXACTLY_ONCE, false);
> localConn.publish("foo/bar", "4".getBytes(), QoS.EXACTLY_ONCE, false);
> localConn.publish("foo/bar", "5".getBytes(), QoS.EXACTLY_ONCE, false);
> org.fusesource.mqtt.client.Message receiveMsg = localConn.receive(100, TimeUnit.SECONDS);
> assertNotNull(receiveMsg);
> receiveMsg.ack();
> String response = new String(receiveMsg.getPayload());
> assertEquals(msg, response);
> MQTT remoteMqtt = createMQTTTcpConnection("foo", false, remoteBrokerMQTTPort);
> BlockingConnection remoteConn = remoteMqtt.blockingConnection();
> remoteConn.connect();
> receiveMsg = remoteConn.receive(100, TimeUnit.SECONDS);
> assertNotNull(receiveMsg);
> receiveMsg.ack();
> response = new String(receiveMsg.getPayload());
> assertEquals("2", response);
> }
> {code}
> results in
> junit.framework.ComparisonFailure:
> Expected :2
> Actual :3
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)