Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How does a client accommodate asynchronous message notifications from the JMS server?

0
Posted

How does a client accommodate asynchronous message notifications from the JMS server?

0

Location: http://www.jguru.com/faq/view.jsp?EID=1214 Created: Nov 22, 1999 Modified: 1999-11-29 12:43:59.136 Author: Jerry Smith (http://www.jguru.com/guru/viewbio.jsp?EID=9) To receive messages asynchronously, a client must: • Implement javax.jms.MessageListener: public interface MessageListener { void onMessage(Message message); } • Register the message handler using setMessageListener(): … subscriber = session.createSubscriber(topic); SubscriberMessageThread smt = new SubscriberMessageThread(this); subscriber.setMessageListener(smt); con.start(); // start connection smt.start(); … The use of a listener for method notifications is similar to using listeners for event notification with graphical AWT clients. Note, however, that every AWT application has a screen-updater thread running in the background that keeps the application alive when main() completes its thread of execution. Certainly, JMS clients vary enormously in function but, in general, some thread of execution must be

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123