|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MDB Receiving Message and the sending |
« View previous topic :: View next topic » |
Author |
Message
|
giorginus80 |
Posted: Wed Nov 19, 2008 2:58 am Post subject: MDB Receiving Message and the sending |
|
|
 Centurion
Joined: 08 Jul 2008 Posts: 124 Location: Rome, Italy
|
Hi,
I have a problem delivering more message to a queue in WAS 6.1.
I explain better:
I have a flow broker, that in the middle of the flow sends a message to a queue. In this queue there is a MDB listening for the message coming, then process the message and at the end, send it back to another queue processed from other flow of the broker. The problem is that all works ok, but if I send 2 or more message to the mdb, yes it's received but when I send it to another queue, it seems that the message is sent (no exception thrown) but in the destination queue there aren't message!!!
I use this for deliver message. Why if receiving more that one message the send seems to works but the message doesn't come to the queue "queue/SirQuintoCampoReply"
Code: |
ConnectionFactory connFactory = ServiceLocatorManager.lookupQueueConnectionFactory("jms/BrokerCF");
Connection connection = connFactory.createConnection();
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
Destination dest = ServiceLocatorManager.lookupQueue("queue/SirQuintoCampoReply");
MessageProducer producer = session.createProducer(dest);
BytesMessage toSend = session.createBytesMessage();
toSend.writeBytes(stream.toByteArray());
producer.send(toSend);
/*Chiusura connessioni*/
producer.close();
session.close();
connection.close();
|
I'm using WAS 6.1, may be some properties have to be add in the descriptor? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 19, 2008 4:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
This is so wrong....
You should use an anonymous sender and use the JMSReplyTo destination...
Code: |
ConnectionFactory connFactory = ServiceLocatorManager.lookupQueueConnectionFactory("jms/BrokerCF");
Connection connection = connFactory.createConnection();
Session session = connection.createSession(true, Session.SESSION_AUTOACKNOWLEDGE);
//Destination dest = ServiceLocatorManager.lookupQueue("queue/SirQuintoCampoReply");
MessageProducer producer = session.createProducer(null);
BytesMessage toSend = session.createBytesMessage();
toSend.writeBytes(stream.toByteArray());
Destination replyto = receivedmsg.getJMSReplyTo();
String correlid = toSend.getJMSCorrelationId(); //= MQC.MQCI_NONE
if correlid.equals(receivedmsg.getJMSCorrelationId()){
toSend.setJMSCorrelationId(receivedmsg.getJMSMessageId());
}else{
toSend.setJMSCorrelationId=receivedmsg.getJMSCorrelationId();
} //endif
producer.send(replyto,toSend);
/*Chiusura connessioni shouldn't this be in a finally section?*/
producer.close();
session.close(); // where is your try block?
connection.close(); // should go to finally |
_________________ MQ & Broker admin |
|
Back to top |
|
 |
giorginus80 |
Posted: Wed Nov 19, 2008 5:17 am Post subject: |
|
|
 Centurion
Joined: 08 Jul 2008 Posts: 124 Location: Rome, Italy
|
fjb_saper wrote: |
This is so wrong....
You should use an anonymous sender and use the JMSReplyTo destination...
Code: |
ConnectionFactory connFactory = ServiceLocatorManager.lookupQueueConnectionFactory("jms/BrokerCF");
Connection connection = connFactory.createConnection();
Session session = connection.createSession(true, Session.SESSION_AUTOACKNOWLEDGE);
//Destination dest = ServiceLocatorManager.lookupQueue("queue/SirQuintoCampoReply");
MessageProducer producer = session.createProducer(null);
BytesMessage toSend = session.createBytesMessage();
toSend.writeBytes(stream.toByteArray());
Destination replyto = receivedmsg.getJMSReplyTo();
String correlid = toSend.getJMSCorrelationId(); //= MQC.MQCI_NONE
if correlid.equals(receivedmsg.getJMSCorrelationId()){
toSend.setJMSCorrelationId(receivedmsg.getJMSMessageId());
}else{
toSend.setJMSCorrelationId=receivedmsg.getJMSCorrelationId();
} //endif
producer.send(replyto,toSend);
/*Chiusura connessioni shouldn't this be in a finally section?*/
producer.close();
session.close(); // where is your try block?
connection.close(); // should go to finally |
|
ok now I try, but how knows the right queue from
Code: |
Destination replyto = receivedmsg.getJMSReplyTo(); |
? Have I to put in the Broker MQOutputNode the field "Reply to" ? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 19, 2008 2:56 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
To populate the JMSReplyTo Destination is the responsibility of the requester.
This can be either a true requester or a message flow or any other piece of software.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
giorginus80 |
Posted: Thu Nov 20, 2008 2:32 am Post subject: |
|
|
 Centurion
Joined: 08 Jul 2008 Posts: 124 Location: Rome, Italy
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|