Hi,
I posted this message at JBoss forums but got no
answer, so I�m trying this list.
I�m new to JMS and JBossMQ and I�m developing a simple
application to learn more about them.
I have a simple MDB that receive a message from a
queue and send it back to the client. Here is the
code:
MDB:
TextMessage message = (TextMessage)msg;
Queue queue = (Queue) msg.getJMSReplyTo();
QueueSender sender = session.createSender(queue);
TextMessage message2 =
session.createTextMessage(message.getText());
sender.send(message2);
sender.close();
Client:
Context context = new InitialContext();
QueueConnectionFactory queueConnectionFactory =
(QueueConnectionFactory)context.lookup("ConnectionFactory");
String queueName = "queue/mdbTestQueue";
Queue queue = (Queue)context.lookup(queueName);
QueueConnection queueConnection =
queueConnectionFactory.createQueueConnection();
QueueSession queueSession =
queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
QueueSender queueSender =
queueSession.createSender(queue);
TextMessage message =
queueSession.createTextMessage();
final String messageString = "This is a TextMessage";
message.setText(messageString);
message.setJMSReplyTo(queue);
queueSender.send(message);
//--------------------------
// Receiver code
//--------------------------
queueConnection.close();
The problem is that it all works fine 80% of the time
and fails the other 20%. And it fails because
getJMSReplyTo() call in MDB returns null these times.
In this cases, the getText() method returns the
expected message (i.e., the only information that get
lost is JMSReplyTo, the rest is intact).
Any hints?
Thanks,
Mauricio
_______________________________________________________________________
Busca Yahoo!
O melhor lugar para encontrar tudo o que voc� procura na Internet
http://br.busca.yahoo.com/
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user