setting up more than one messageListener and a timeout mechanism
METIN ZAVRAK <[email protected]>
| Newsgroups | gmane.comp.java.openjms.user |
|---|---|
| Message-ID | <OFF11AF577.99A5CDF0-ONC2256FA2.0049DD23-C2256FA2.004C9AD2@o2.com.tr> |
Hi,
I am planning to use openJMS in a critical project.
I have to process massive amount of messages.
I want to implement something as follows:
* I will listen a gateway and fetch all the messages coming from the
gateway
* push all the fetched messages in a queue. (this is a synchronous process
- I will use a blocking API to fetch messages coming from gateway)
* then I will use messageListeners to process messages in queue and send
the messages to appropriate services. (this is an asynchronous process)
And the questions:
* How can I implement more than one messageListener? (I want to bind 10
or more messageListeners to the queue)
* If any time, processing fails, how can I be sure that the message will
be redelivered? Should I use transactedSessions? I couldn't find an
example using transactedSessions.
* I want to implement a timeout mechanism. Should I depend on JMS
capabilities or should I use timers to implement it.
Here is the code fragment I used to implement sender and receiver. Could
you please send a link or example.
Initializing JMS and sending messages to queue
*******************************************************************************************************
JMSInitializerLogger.info("Creating JNDI context");
setContext(createJNDIContext());
JMSInitializerLogger.info("Creating USSDMessageQueue");
setConnection(createQueueConnection(getContext()));
JMSInitializerLogger.info("Creating session for USSDMessageQueue");
setSession(createQueueSession(getConnection()));
JMSInitializerLogger.info("Creating the queue (queue name is
'USSDMessageQueue')");
setQueue(createQueue(getSession(), "USSDMessageQueue"));
JMSInitializerLogger.info("Creating sender");
setSender(createSender(getSession(), getQueue()));
while(true){
try {
TextMessage message = session.createTextMessage("100");
sender.send(message);
}
...
Listening queue and processing them with onMessageMethod
*****************************************************************************
MessageQueueListener mql = new MessageQueueListener("test");
MessageQueueListener mql2 = new MessageQueueListener("test2");
MessageQueueListener mql3 = new MessageQueueListener("test3");
qrecv.setMessageListener(mql);
qrecv2.setMessageListener(mql2);
qrecv3.setMessageListener(mql3);
This doesn't work....
Any ideas?
Metin Zavrak
================
Yazılım Geliştirme Mühendisi
VAS - SMSC
0 533 632 87 68
-------------------------
http://www.oksijen.com
-------------------------
The information contained in this message is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be protected by professional secrecy. You should not copy, disclose or distribute this information for any purpose. If you are not the intended recipient of this message or you receive this mail in error, you should refrain from making any use of the contents and from opening any attachment. In that case, please notify the sender immediately and return the message to the sender, then, delete and destroy all copies. This e-mail message has been swept by anti-virus systems for the presence of computer viruses. In doing so, however, we cannot warrant that virus or other forms of data corruption may not be present and we do not take any responsibility in any occurrence.
Bu e-posta mesajı kişiye özel olup, gizli bilgiler içeriyor olabilir. Eğer bu e-posta mesajı size yanlışlıkla ulaşmışsa, e-posta mesajını kullanıcıya hemen geri gönderiniz ve mesaj kutunuzdan siliniz. Bu e-posta mesajı, hiç bir şekilde, herhangi bir amaç için çoğaltılamaz, yayınlanamaz ve para karşılığı satılamaz. Yollayıcı, bu e-posta mesajının - virüs koruma sistemleri ile kontrol ediliyor olsa bile - virüs içermediğini garanti etmez ve meydana gelebilecek zararlardan doğacak hiçbir sorumluluğu kabul etmez.