Author |
Message
|
radaev |
Posted: Thu Oct 07, 2004 6:55 am Post subject: No transaction for JMS recieve with selector(MQ without CSD) |
|
|
 Newbie
Joined: 07 Oct 2004 Posts: 6
|
Hello! Receive with JMS selector is not under syncpoint!
I am trying to receive one message with selector in the transaction. It didn't work!!!??? Does any body have idea what could be the reason?
My plattform:
- IBM Webspere 5.3 running on one Solaris machine
- Remote TCP/IP Connect from IBM JMS Client
Code: |
MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
...
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
QueueConnection connection = factory.createQueueConnection();
QueueSession session = connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
Queue q1 = session.createQueue("MY.OUT");
QueueReceiver receiver = session.createReceiver(q1, "PROPERTY = 'Wert'");
Message nachricht = (TextMessage)receiver.receiveNoWait();
session.rollback();
|
Output file from java -DMQJMS_TRACE_LEVEL=on MQTest
Code: |
com.ibm.mq.jms.MQQueueReceiver@116ab4e <== setMessageSelector() exit
com.ibm.mq.jms.MQQueueReceiver@116ab4e returned from inquire, threshold = 0, borq = ''
|
And without selector ( session.createReceiver(q1); )
Code: |
com.ibm.mq.jms.MQQueueReceiver@116ab4e <== setMessageSelector() exit
com.ibm.mq.jms.MQQueueReceiver@116ab4e syncpoint enabled
com.ibm.mq.jms.MQQueueReceiver@116ab4e returned from inquire, threshold = 0, borq = ''
|
Now my question: is it a BUG???
Thanks for any help. 
Last edited by radaev on Tue Oct 12, 2004 11:39 pm; edited 3 times in total |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 07, 2004 12:21 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Your selector does not look quite right. Checkout the samples and specifically correlation id. This should point you in the right direction.
Enjoy
Selbst getan weiss Man's am Besten. |
|
Back to top |
|
 |
radaev |
Posted: Fri Oct 08, 2004 12:23 am Post subject: |
|
|
 Newbie
Joined: 07 Oct 2004 Posts: 6
|
Hi, selector is OK. I recieve messages with this selector. The problem is no transaction support!
Manual from IBM say:
Each message contains a built-in facility to support application-defined property values. Properties provide an efficient mechanism to filter application-defined messages.
Let us select over JMSPriority
Code: |
QueueReceiver receiver = session.createReceiver(q1, "JMSPriority = 4"); |
No syncpoint!!!
Other ideas?  |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Oct 08, 2004 1:33 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Please do not mix java base and JMS.
java base: syncpoint
java base: qmgr.commit();
JMS: connection.createSession(True, Session.AUTO_ACKNOWLEDGE);
JMS:qsession.commit()
The fact that you are specifying for the session to be transacted will do it for you. Remember that when you run under WAS this is overriden by the WAS settings for your EJB method.
Enjoy  |
|
Back to top |
|
 |
radaev |
Posted: Mon Oct 11, 2004 12:13 am Post subject: |
|
|
 Newbie
Joined: 07 Oct 2004 Posts: 6
|
Thanks for your reply! However, I can not recieve messages in the transaction, when one selector has been specified.
I have tried the simple testing using standalone java client in all the connection options (TCP/IP and bindings). The recieved message was after rollback not in the queue!!!
Could you test this case with your configuration? Please... |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Oct 11, 2004 9:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Hi Guys,
Somebody else will have to test his setup because I'm off vacationning in Europe for a few weeks...
However it seems to me that you're going at it the wrong way. Typically in a request response model there is no sense in using an MDB and selector. Because you would only ever catch 1 message ?
In a request response model you can only catch the message with the corresponding correlation id to go the "complete" safe way.
Using the Listener will only work in a non XA setup. It you want to use a listener in an XA setup be sure to add the WAS's tx*.jar files to your classpath and grab a user transaction and before you start the connection enlist both XA resources (DB and MQ)
So much for JMS...
Now you should as well check the DLQ as if you have a backout threshold specified and are running an MDB ... after bothresh attempts the message might just land in the BO Q and if not specified in the DLQ.
One final reminder: Hope you are not treating the correlationID as a string. It is a bytë[] and thus the content never gets translated (ebcdic-ascii). And if you use a transacted session you should always explicitly commit or rollback the session.
F.J.  |
|
Back to top |
|
 |
radaev |
Posted: Tue Oct 12, 2004 8:06 am Post subject: |
|
|
 Newbie
Joined: 07 Oct 2004 Posts: 6
|
A!A!A! Help for those who lost messages!
I have the following functionality in my test application:
Code: |
import javax.jms.*;
import com.ibm.mq.jms.*;
public class MQTst{
public static void main(String[] args) throws Exception{
QueueSession session = null;
QueueConnection connection = null;
MQQueueConnectionFactory factory = null;
try {
factory = new MQQueueConnectionFactory();
factory.setChannel("Server Connection Channel");
factory.setHostName(" IP ");
factory.setPort(1414);
factory.setQueueManager("Your QM");
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
connection = factory.createQueueConnection();
session = connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
Queue q1 = session.createQueue("SYSTEM.DEFAULT.LOCAL.QUEUE");
QueueReceiver receiver = session.createReceiver(q1, "JMSCorrelationID IS NULL");
connection.start();
System.out.println("Receive the message: " + receiver.receiveNoWait());
session.rollback();
}
finally {
session.close();
connection.close();
}}}
|
Could someone test this code in your configuration?
Thanks in advance for any help!  |
|
Back to top |
|
 |
bower5932 |
Posted: Tue Oct 12, 2004 9:22 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
On Windows XP, using:
Code: |
Name: WebSphere MQ
Version: 530.7 CSD07
CMVC level: p530-07-L040527
BuildType: IKAP - (Production) |
The program gets a message and then rolls it back. When the message is dumped out, you can see:
JMSCorrelationID:null
and the message is being redelivered as you re-run the program:
JMSRedelivered: true
JMSXDeliveryCount:5 |
|
Back to top |
|
 |
radaev |
Posted: Tue Oct 12, 2004 11:36 pm Post subject: |
|
|
 Newbie
Joined: 07 Oct 2004 Posts: 6
|
Thank you for your response!!!
We use test server in this configuration:
Code: |
Name: WebSphere MQ
Version: 530
CMVC level: p000-L020617
BuildType: IKAP - (Production)
|
What min CSD must we install?
Best Regards
Andrey |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Oct 13, 2004 2:45 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I don't know about a 'minimum'. There were a lot of JMS related fixes in FixPack 4. However, I'd suggest that you go with the latest (especially when you are having problems). |
|
Back to top |
|
 |
|