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/06/23 19:39:25 UTC
[jira] [Resolved] (AMQ-4692) ActiveMQ broker does not publish last
will messages
[ https://issues.apache.org/jira/browse/AMQ-4692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timothy Bish resolved AMQ-4692.
-------------------------------
Resolution: Duplicate
Fix Version/s: 5.9.1
5.10.0
Fixed by later issue.
> ActiveMQ broker does not publish last will messages
> ---------------------------------------------------
>
> Key: AMQ-4692
> URL: https://issues.apache.org/jira/browse/AMQ-4692
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker, MQTT
> Affects Versions: 5.8.0
> Environment: win7 64 OS.
> Reporter: greywolf
> Fix For: 5.10.0, 5.9.1
>
>
> When I run a MQTT client(paho or fuse)to connect ActiveMQ broker. if i terminate this client and can not receive LWT messages from broker.
> I changed broker from ActiveMQ to Mosquitto broker , everything is ok.
> below is my test class:
> package com.paho;
> import org.eclipse.paho.client.mqttv3.MqttCallback;
> import org.eclipse.paho.client.mqttv3.MqttClient;
> import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
> import org.eclipse.paho.client.mqttv3.MqttDeliveryToken;
> import org.eclipse.paho.client.mqttv3.MqttException;
> import org.eclipse.paho.client.mqttv3.MqttMessage;
> import org.eclipse.paho.client.mqttv3.MqttSecurityException;
> import org.eclipse.paho.client.mqttv3.MqttTopic;
> public class Sub {
> private MqttClient mqttClient;
>
> public void subscriber(){
> try {
> mqttClient = new MqttClient("tcp://192.168.100.80:1883", MqttClient.generateClientId());
>
> MqttConnectOptions connectOptions = new MqttConnectOptions();
> //set will
> connectOptions.setWill(mqttClient.getTopic("lastwill"), new String("I am offline").getBytes(), 1, false);
> mqttClient.connect(connectOptions);
> mqttClient.setCallback(new MqttCallback(){
> public void connectionLost(Throwable paramThrowable) {
> System.out.println("Connection Exist. \nCause: " + paramThrowable);
> while(true){
> try {
> Thread.sleep(20000);
> if(!mqttClient.isConnected()){
> subscriber();
> }
> } catch (InterruptedException e) {
> e.printStackTrace();
> }
> }
> }
> public void messageArrived(MqttTopic paramMqttTopic,
> MqttMessage paramMqttMessage) throws Exception {
> System.out.println("Message arrived From The Topic:\t"+paramMqttTopic.toString() +" \nMessage: " + paramMqttMessage.toString());
> }
> public void deliveryComplete(
> MqttDeliveryToken paramMqttDeliveryToken) {
> }
>
> });
>
> mqttClient.subscribe("durable",1);
> // mqttClient.subscribe("durable1",1);
>
> } catch (MqttException e) {
> e.printStackTrace();
> }
> }
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> Sub sub = new Sub();
> sub.subscriber();
> }
> }
--
This message was sent by Atlassian JIRA
(v6.2#6252)