|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MDB not listening when msg comes from third system. |
« View previous topic :: View next topic » |
Author |
Message
|
betterchoices |
Posted: Fri Jun 12, 2009 2:32 am Post subject: MDB not listening when msg comes from third system. |
|
|
Novice
Joined: 08 Jun 2009 Posts: 18
|
HI
I am using JCA architecture, I wrote MDB with Resource Adaptor to listen to a MQ. I created Queue Manager, Queue, .bindings file. Now I created a Resource Adaptor, descriptor files, MDB and deployed .ear to oc4j.
I put one test message in Queue(I am using MQ Explorer), and my MDB is invoked. So everything workes, I even manually put 200, then 500, and then 2000 messages on queue(using MQ Explorer right Click Queue ->put test Message). And all messages were picked by MDB.
Now, I want to load test with 5000 and more messages. I wrote a java program to put messages in the Queue(expecting MDB would pick them). But this time MDB is not invoked.
Problem is when I put test message manually then MDB is invoked, but when I put messages using my java program then messages are not picked.
My code to put message is:
MQMessage msg = new MQMessage();
msg.writeString(message);
MQPutMessageOptions pmo = new MQPutMessageOptions();
queue.put(msg, pmo);
Peviously I wrote some adaptors which were listening and putting the messages on MQ. And I was using similar code.
Using the code, I can put messages on MQ successfully, but problem is my MDB(deployed over oc4j using JCA) is not able to listen it. MDB's onMessage() is not invoked. But If i put message using MQ Exporer(right click Queue -> Put Test Message), then MDB's onMessage() is invoked.
I can't understand this. Another Issue, is due to security reasons I can'e download and install tools like JMeter, etc. which can be used for load test. I have to write a standlone java program for that. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jun 12, 2009 2:51 am Post subject: Re: MDB not listening when msg comes from third system. |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
betterchoices wrote: |
I wrote a java program to put messages in the Queue(expecting MDB would pick them). But this time MDB is not invoked.
Problem is when I put test message manually then MDB is invoked, but when I put messages using my java program then messages are not picked. |
Do the messages arrive in the target queue, i.e. visible in MQExplorer ? Are they properly committed (my Java is insufficient to determine that from the code), as shown by queue attributes? Does the sample app amqsget respond to the messages put from your Java? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
betterchoices |
Posted: Fri Jun 12, 2009 3:13 am Post subject: |
|
|
Novice
Joined: 08 Jun 2009 Posts: 18
|
Do the messages arrive in the target queue, i.e. visible in MQExplorer ?
Yes.
Are they properly committed (my Java is insufficient to determine that from the code), as shown by queue attributes?
here is some more code:
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_OUTPUT;
queue = qMgr.accessQueue(qName, openOptions);
MQMessage msg = new MQMessage();
msg.writeString(message); // I evevn tris writeObject(), etc.
MQPutMessageOptions pmo = new MQPutMessageOptions();
queue.put(msg, pmo);
// I dont anything after this, and when my program runs. Messages are put in the Queue, means I can view them in the MQ Explorer.
I am a Java programmer, but new to MQ. I have been writting applicartions which communicate to MQ some time back, and I am again doing after some time. but based on my past exp, this much code is sufficient. I dont commit any where, but i think when i can see those message sin MQ Explorer, then it means they are commited, and done from from that Java program side.
What can be issue, is that In MDB(Message Driven Bean's) onMessage() method Message is parameter i.e. javax.jms.Message. There can be some mismatch here, means the message is not able to assigned to javax.jms.Message. But still, point here is when I put manually then MDB is invoked.
Does the sample app amqsget respond to the messages put from your Java? My MDB doesn't responds to the message, its onMessage method is not called or invoked.
The sample program to populate the queue ionly puts message, and soesn't picks them, Well. I would write on another java program to pick messages from the queue, but I know, that that would be successful. that individual java would pick(what I expect), but MDB is not able to pick. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jun 12, 2009 3:25 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
betterchoices wrote: |
I am a Java programmer, but new to MQ. |
Well I don't know Java from a hole in the ground. I know some holes better than I know Java.
betterchoices wrote: |
I think when i can see those message sin MQ Explorer, then it means they are commited |
I wouldn't count on that but if you're sure
betterchoices wrote: |
What can be issue, is that In MDB(Message Driven Bean's) onMessage() method Message is parameter i.e. javax.jms.Message. There can be some mismatch here, means the message is not able to assigned to javax.jms.Message. |
Ok, here you lose me completely.
betterchoices wrote: |
Does the sample app amqsget respond to the messages put from your Java? My MDB doesn't responds to the message, its onMessage method is not called or invoked. |
I'm still banging on about uncommitted messages. As amqsget know less about Java than I do it's a way of ensuring the messages are available irrespective of their Java-ness. But as you're confident they're committed we can move past that.
I'm sure someone else will be along in a minute with better help. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
betterchoices |
Posted: Fri Jun 12, 2009 3:50 am Post subject: |
|
|
Novice
Joined: 08 Jun 2009 Posts: 18
|
Yes.. I got your point.. I should check with amqsget first,, before going further..
I put message "test" on Queue
I run this command from cmd. .
amqsget <Queue Name> <Queue Mgr Name>
Scenario 1: When I manually put message
message <test>
// successful..
Scenario 2: When I use the Java program to put messages.
MQGET endede with reason code 2110
message <1/4.....>/// some wired teat here
Now I check the for reason code..And now i know there is some problem with the format... OK.. I fix this and then check again...
Thank You very much..... I wud check if there is only format problem or something else also...
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jun 12, 2009 4:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
betterchoices wrote: |
Now I check the for reason code..And now i know there is some problem with the format... OK.. I fix this and then check again... |
For what it's worth (and remember I have very limited Java!) I would imagine the message is not being put as a text message. AFAIK this sets the format field to string, which is required for the conversion get option.
I could be completely wrong, but it might be a place to start looking. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
betterchoices |
Posted: Fri Jun 12, 2009 5:30 am Post subject: |
|
|
Novice
Joined: 08 Jun 2009 Posts: 18
|
Vitor,
All my problems are solved..... I put messages in Queue using a java program, and then my mdb is able to pick those messages..
Earlier, my MDB was not invoked...I put messages on queue using java program...but mDB's onMessage() was not invoked, i.e. MDB was not able to pick those messages.. even though I can see the messages in the mq EXPLORER..
I run ths command(suggested by you): amqsget
And I got error message code 2110.
And I found this error code is related to format.
I added this one line code:
msg.format = MQC.MQFMT_STRING ;
in my java program which was sending messages to queue(to which my MDB is listeneing).
And all problems were solved. As soon as messages arrives to the Queue, mdb is invoked.
Thank you very much... |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jun 13, 2009 5:28 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Looking at your choices, I do not understand why you didn't write a standalone JMS program for populating your queue. Granted this would not have let you to the discovery of message format importance and quirks but you would probably not have had to deal with those in the first place...
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
betterchoices |
Posted: Sun Jun 14, 2009 12:49 am Post subject: |
|
|
Novice
Joined: 08 Jun 2009 Posts: 18
|
yes.. u r right... i made this mistake.....
but i only did this because in my company...there is no MQ admin or expert and they wanted a stanlone MQ application(small program) to put and get messages in MQ. with a properties file.. so that they set message text and no of messages.. and application which would be picking the messages can be a MQ program, or JMS program, or any thing else.. I thought there would be no issue.. as previously i wrote some adaptor programs which were putting and getting messages form MQ.
But I never faced format issue, because.. application which was putting messge and application which was picking messages both were MQ program.. I didnt kne there would be a format issue..... but this time it was MDB which was picking messages and which was using JMS format.
Next time I would consider this issue...
Thank you so much for guidance... thanks there was MQSeries.net forum.. that my issue was resolved..... u cant imagine how much i am thankful.. to this forum, victor, and you....it was so crirical..
slowly i m learing the MQ more and more...
Thanks |
|
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
|
|
|
|