activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "greywolf (JIRA)" <>
Subject [jira] [Created] (AMQ-4692) ActiveMQ broker does not publish last will messages
Date Tue, 27 Aug 2013 06:05:53 GMT
greywolf created AMQ-4692:

             Summary: ActiveMQ broker does not publish last will messages
                 Key: AMQ-4692
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker, MQTT
    Affects Versions: 5.8.0
         Environment: win7 64 OS.
            Reporter: greywolf

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://", MqttClient.generateClientId());

			MqttConnectOptions connectOptions = new  MqttConnectOptions();

			//set will
			connectOptions.setWill(mqttClient.getTopic("lastwill"), new String("I am offline").getBytes(),
1, false);
			mqttClient.setCallback(new MqttCallback(){

				public void connectionLost(Throwable paramThrowable) {
					System.out.println("Connection Exist. \nCause: " + paramThrowable);
						try {
						} catch (InterruptedException e) {

				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("durable1",1);

		} catch (MqttException e) {


	 * @param args
	public static void main(String[] args) {
		Sub sub = new Sub();


This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message