Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mqtt Client in JEE application under JBoss  RSS feed

 
Antonio Foglia
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody.
I've developed a test JEE application to send and receive messages through MQTT protocol(tcp connection). Under JBoss 7.1 i got a @Singleton @Startup that instantietes an Eclipse Paho Client and a Callback class.


I want to update received values to another bean. But in my Callback class i cannot inject any EJB (it breaks tcp connection) so i get the PahoClient instance in this way as you can see above:


So when i receive a message on my callback method i update values in this way public class SubscribeCallback implements MqttCallback{



It seems to work fine. But in console i see is MQTT thread that updates message, not the EJB. And i don't know if with a lot connection this works. Any Suggestion? I was thinking about to develop a JCA Adapter for my MQTT Client and my JEE application. But i don't kno w if it's the right way.

Thanks
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Antonio Foglia wrote:

Using this to pass a reference in EJBs is a cardinal sin. Instead, you should get a business object reference, using SessionContext:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!