Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Publish and persistence issue(Publish and persistence issue)
Publish and persistence issue [message #1073123] Wed, 24 July 2013 03:23
Atique Khan is currently offline Atique Khan
Messages: 1
Registered: July 2013
Junior Member
Hi there,

I am facing a strange problem while publishing to some topics. I have a web application which runs under JBoss 5. This application uses Eclipse Paho to publish to a broker as well as subscribe. The subscribe part is working fine without any issue. The problem is with publishing. My application starts to publish without any issue. If I restart the application from JBoss admin console then it fails to publish any further message to any topic. If I restart JBoss then it starts working again. The exception I am getting is
MqttException (0) - java.io.FileNotFoundException: \home\itms\mqttproxy\MQTT_PROXY_PUB_1_36-tcp17216201837971\s-1.msg (The system cannot find the path specified)
	at org.eclipse.paho.client.mqttv3.MqttDefaultFilePersistence.put(MqttDefaultFilePersistence.java:175)
	at org.eclipse.paho.client.mqttv3.internal.ClientState.send(ClientState.java:397)
	at org.eclipse.paho.client.mqttv3.internal.ClientComms.internalSend(ClientComms.java:81)
	at org.eclipse.paho.client.mqttv3.internal.ClientComms.sendNoWait(ClientComms.java:118)
	at org.eclipse.paho.client.mqttv3.MqttTopic.publish(MqttTopic.java:62)
	at org.quwic.itms.mqtt.connection.MqttClientConnection.publish(MqttClientConnection.java:157)
	at org.quwic.itms.mqtt.connection.MqttClientPublishingConnection.publish(MqttClientPublishingConnection.java:35)
	at org.quwic.itms.mqtt.consumer.PublishingQueueConsumer.run(PublishingQueueConsumer.java:53)
	at java.lang.Thread.run(Thread.java:619)


I have checked everything and there is no permission issue else it will not publish in the very first instance.

The code used for publishing is
ConnectionBean conOpt = new MqttConnectOptions();
conOpt.setCleanSession(conBean.getCleanSession());
conOpt.setUserName(conBean.getUsername());
conOpt.setPassword(conBean.getPassword().toCharArray());
conOpt.setKeepAliveInterval(120);
conOpt.setConnectionTimeout(conBean.getTimeout());

String brokerUrl = "tcp://" + conBean.getHost() + ":" + conBean.getPort();
MqttClientPersistence dataStore = new MqttDefaultFilePersistence("/home/itms/mqttproxy");
client = new MqttClient(brokerUrl, conBean.getClientId(), dataStore);
client.setCallback(this);
client.getPendingDeliveryTokens();
client.connect(conOpt);

String strMessage = "hello publishing";
MqttMessage message = new MqttMessage(strMessage.getBytes());
message.setQos(qos);
message.setRetained(retained);
    	
MqttTopic mqttTopic = client.getTopic(topicName[0]);
MqttDeliveryToken token = mqttTopic.publish(message);
if(token != null)
      token.waitForCompletion();



Could you please suggest what could be the problem. Any help will be highly appreciated.

Thanks,
Previous Topic:MQTT Java Client Binary Jar out of Step with GIT code
Next Topic:Trouble compiling Paho java plugin
Goto Forum:
  


Current Time: Sat Apr 19 02:59:25 EDT 2014

Powered by FUDForum. Page generated in 0.02192 seconds