Author |
Message
|
tina |
Posted: Tue Aug 03, 2004 1:09 pm Post subject: JMS and MQ base Java API |
|
|
Newbie
Joined: 03 Aug 2004 Posts: 6
|
We have JMS code and now we have cluster where we
need to send messages to a particular queue instance.
I found in the doc that we can use MQOPEN BIND_ON_OPEN
option, but is this option available to JMS code?
Must we then rewrite our code in base Java if we have to
support this queue affinity?
BTW, is it possible for JMS code to exchange message
with another application written in C++, should be, right?
But how is the image format mapped? |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Aug 03, 2004 3:24 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
In your JNDI setup specify qmgr and base qname.
This should then send the message to the relevant queue on the relevant queue manager.
Hope it helps.
F.J. |
|
Back to top |
|
 |
EddieA |
Posted: Tue Aug 03, 2004 4:20 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
BTW, is it possible for JMS code to exchange message
with another application written in C++, should be, right? |
Yes. You will either have to "teach" the other application how to understand RFH2 headers. Or, more simply, set the option, on the JMS side, not to use RFH2 headers.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
tina |
Posted: Tue Aug 03, 2004 6:44 pm Post subject: |
|
|
Newbie
Joined: 03 Aug 2004 Posts: 6
|
fjb_saper wrote: |
In your JNDI setup specify qmgr and base qname.
This should then send the message to the relevant queue on the relevant queue manager.
Hope it helps.
F.J. |
Please bear my very limited knowledge on MQSeries:
in the document on clusters:
http://publibfp.boulder.ibm.com/epubs/pdf/csqzah06.pdf
page 53.
According to that document, there are couple of ways to
realize the message affinity. There BIND_ON_OPEN is mentioned
as a solution. So my question is how can we use this option in JMS?
Also, assuming we have three queue managers QM1, QM2, and QM3
and we define the same queue in both QM1 and QM2. Queue name is
Q1.
The MQOPEN takes argument of queue manager name, option, etc.
Is the way you suggested is like specify the physical queue manager
and queue and JMS will figure out which to contact. Is this what is
discussed in the section "Name a specific destination on the
MQOPEN call"? Somehow I thought that with multiple instances
of a queue, the cluster route messages and this is inrelevant to
which queue manager you specify (BTW, MQQueueMananger also
takes a queue name as an argument).
Thanks a lot. |
|
Back to top |
|
 |
tina |
Posted: Tue Aug 03, 2004 6:55 pm Post subject: |
|
|
Newbie
Joined: 03 Aug 2004 Posts: 6
|
EddieA wrote: |
Quote: |
BTW, is it possible for JMS code to exchange message
with another application written in C++, should be, right? |
Yes. You will either have to "teach" the other application how to understand RFH2 headers. Or, more simply, set the option, on the JMS side, not to use RFH2 headers.
Cheers, |
One more question, beside the WebSphere MQ for java, is there
any other document on RFH2 format?
Thanks for your reply. |
|
Back to top |
|
 |
EddieA |
Posted: Tue Aug 03, 2004 9:54 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Application Programming Reference contains the layout of all the (published) structures.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Aug 04, 2004 9:49 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Tina, if you PUT an MQ message that has a destination queue AND a destination queue manager accociated with it (you filled both of those when you did the open of the queue), then all the messages that you put with that connection handle will want to go to that specific destination queue on that specific destination queue manager. Round Robining will not occur if you are telling MQ which QM to go to.
This method is not quite exactly what BIND_ON_OPEN does. BIND_ON_OPEN says "Hey, I don't care which QM in the cluster I go to to put to Queue1, but every message that I send under this handle I want to go to that same QM (whichever one you pick for me) that host Queue1".
Contrast this to the 1 st paragraph, which is saying "Hey, I DO care which QM I send all these messages to. I don't want round robining, AND I care which particular QM I get. Here is the QM I want to go to."
Close, but not exactly the same.
I have never coded a JMS app so keep that in mind: Looking in all the manuals, I cannot find anything that says JMS supports BIND_ON_OPEN. Maybe it does respect the queue default, so you could have the MQ System Admin set up your queues that way and run some tests to see if you Bind to one of them.
The other option is to do your own Psuedo binding and just specify the QM name in the MQOPEN call. But that kinda stinks cause now you have to be aware of the QM names in the cluster and it will be up to you to decide if your program always binds to one particular QM or if you have to cycle thru them somehow by choosing a different QM on the MQOPEN call each time. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 04, 2004 10:04 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Using Java wrote: |
Note:
When sending a message to a cluster, leave the Queue Manager field in the JMS Queue object blank. This enables an MQOPEN to be performed in BIND_NOT_FIXED mode, which allows the queue manager to be determined. Otherwise an exception is returned reporting that the queue object cannot be found. This applies when using JNDI or defining queues at runtime. |
If you specify a Queue Manager name, the JMS provider will open the queue with BIND_ON_OPEN.
In addition, in the WebSphere MQ JMS Provider Queue Definition, there is a property
WebSphere Application Server InfoCenter wrote: |
Default Binding
The default binding to be used when the queue is defined as a cluster queue.
Data type Enum
Default Null
Range A
On open
The queue handle is bound to a specific instance of the cluster queue when the queue is opened.
Not fixed
The queue handle is not bound to any particular instance of the cluster queue. This allows the queue manager to select a specific queue instance when the message is put, and to change that selection subsequently should the need arise. |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Aug 04, 2004 10:09 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
You would think they would put that info in the MQSeries manuals....
Thanks Jeff. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
tina |
Posted: Wed Aug 04, 2004 11:20 am Post subject: |
|
|
Newbie
Joined: 03 Aug 2004 Posts: 6
|
PeterPotkay wrote: |
You would think they would put that info in the MQSeries manuals....
Thanks Jeff. |
You guys are really good.
I run a test server of version 5.0 in WSAD and invoked
the admin console. While I did find that I can set properties
but not all of them listed in the WebSphere information center.
What I see are properties from Name, JNDI Name, till
Expiry, and Specified Expiry. The rest are nowhere to find.
I guess this is because I have not had everything installed
on my local machine.
By the way, I saw there are two JMS providers:
Generic JMS provider, and
WebSphere JMS provider.
I used the latter one.
What is the difference between them?
Thanks a lot I really appreciate. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 04, 2004 11:31 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You should have three JMS providers.
Generic JMS Provider
WebSphere JMS Provider
AND
WebSphere MQ JMS Provider
The generic JMS provider is for a non IBM JMS provider.
The WebSphere JMS Provider is for IBM's Embedded Messaging (which is sort of a lightweight WebSphere MQ)
The WebSphere MQ JMS Provider is for WebSphere MQ. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
tina |
Posted: Wed Aug 04, 2004 11:48 am Post subject: |
|
|
Newbie
Joined: 03 Aug 2004 Posts: 6
|
jefflowrey wrote: |
You should have three JMS providers.
Generic JMS Provider
WebSphere JMS Provider
AND
WebSphere MQ JMS Provider
The generic JMS provider is for a non IBM JMS provider.
The WebSphere JMS Provider is for IBM's Embedded Messaging (which is sort of a lightweight WebSphere MQ)
The WebSphere MQ JMS Provider is for WebSphere MQ. |
You are right. I used the WebSphere JMS provider, which
is light-weighted, and therefore I could only configured some of
the properties (till specifyExpiry). With
WebSphere MQ JMS provider, I saw every properties,
including queue name, queue manager name, hosting machine
and port, etc.
Thanks! |
|
Back to top |
|
 |
|