In a MDB, I received a message from Queue A and want to send that message to
Queue B.
public void onMessage(Message inmessage)
{
try
{
// Get the input message (Inquiry.xml) from Queue A
ctx = new InitialContext();
cf =
(QueueConnectionFactory)ctx.lookup("ConnectionFactory");
destination = (Queue)ctx.lookup("queue/A");
connection = cf.createQueueConnection();
session =
connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
receiver = session.createReceiver(destination);
System.out.println("Waiting For A Message.");
connection.start();
message = (TextMessage)receiver.receive();
System.out.println("The Input message is:
"+message.getText());
connection.close();
// Put transformed message into Queue B
System.out.println("Start--- Put Transformed message
into Queue B");
queOutput = (javax.jms.Queue)ctx.lookup("queue/B");
connectionOutput = cf.createQueueConnection();
sessionOutput =
connectionOutput.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
senderOutput = sessionOutput.createSender(queOutput);
messageOutput = sessionOutput.createTextMessage();
messageOutput.setText(transformed_message);
senderOutput.send(message.getText());
connectionOutput.close();
System.out.println("End--- Put Transformed message into
Queue B");
If I put the code for the sending the message to queue B, it does not work. It
does not even get the message from Queue A. However i remove the send of the
message to queue B, the listening part for queue A works.
Do we have to mention anything specific in xml configuration files to refer to
queue B?
Thanks for your help.
Regards
Shriram
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3937840#3937840
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3937840
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user