Author |
Message
|
Vin |
Posted: Wed Mar 27, 2002 8:57 pm Post subject: |
|
|
Master
Joined: 25 Mar 2002 Posts: 212 Location: India
|
Guys,
I'm new to MQSeries and really getting confused with some concepts. I have a remote Queue from which to get messages. I need to wait for a bunch of messages before processing them. The first thing I know of is that I need to work with channels and tranmission Queues. I'm really stuck up deciding on whether to use MQ Java or MQ JMS. MQ Java really looks simple after going through a couple of samples. Is this a good idea? If at all I use MQ Java then how will I retrieve messages from the Queue using a listener? Can I do that with MQJava? I know there is a Message Listener class in MQ JMS, is there something in MQ Java? Also if anyone has worked with remote queues can you point me to some code samples or any prototype which you have? Appreciate each one of your help in making me clear on these concepts. |
|
Back to top |
|
 |
kirani |
Posted: Thu Mar 28, 2002 1:57 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I would like to make this comment regarding remote queues.
You can PUT messages on remote queues, but you can GET messages only from the queues local to your queue manager.
|
|
Back to top |
|
 |
Vin |
Posted: Thu Mar 28, 2002 6:56 pm Post subject: |
|
|
Master
Joined: 25 Mar 2002 Posts: 212 Location: India
|
Thanks for the tip. Do you how I can access a remote queue? If I need to put a message on a remote queue, can I use the QueueManager.accessQueue(QueueName) fucntion or do i have to do something different? Any pointers on this? Thanks. |
|
Back to top |
|
 |
abiram8 |
Posted: Fri Mar 29, 2002 3:24 am Post subject: |
|
|
 Master
Joined: 27 Mar 2002 Posts: 207 Location: India
|
Hi,
There is the direct way of doing the things check out the variables of MQMessage which gives the information on hostname,port etc..
GoodLuck
R.Abiram |
|
Back to top |
|
 |
Vin |
Posted: Fri Mar 29, 2002 12:22 pm Post subject: |
|
|
Master
Joined: 25 Mar 2002 Posts: 212 Location: India
|
abiram,
I could not quiet get you. Is there an example somewhere which I can refer to? I mean The QueueManager.accessQueue(QueueName) actually the job of access queue right? Is this the same memthod which I use for posting messages to a remote Queue? Thanks. |
|
Back to top |
|
 |
StefanSievert |
Posted: Fri Mar 29, 2002 1:30 pm Post subject: |
|
|
 Partisan
Joined: 28 Oct 2001 Posts: 333 Location: San Francisco
|
Vin,
if you MQPUT to a queue, there is no difference whatsoever to your application code wether it actually is a local queue hosted by the queue manager you are connected to, or a local definition of a remote queue that is physically hosted on a different queue manager. Both puts end up on a physical local queue. In the case of a remote queue definition, the message will be put to the transmission queue that has been specified in the DEFINE QREMOTE command.
As others have mentioned, you can't get from a remote queue, i.e. a queue that is physically hosted by another queue manager than the one you are MQCONNected to. If you need to get messages from a 'remote' location, you will need to set up the necessary MQ object definitions on the remote queue manager to transmit the messages to your 'local' queue manager and get them from there.
Hope that helps,
Stefan
________________
Stefan Sievert
IBM Certified * MQSeries
[ This Message was edited by: StefanSievert on 2002-03-29 13:31 ] |
|
Back to top |
|
 |
Vin |
Posted: Fri Mar 29, 2002 1:46 pm Post subject: |
|
|
Master
Joined: 25 Mar 2002 Posts: 212 Location: India
|
Stefan,
Thanks so much for making me clear on that. The way to access the transmission queue is QueueManager.accessQueue(QueueName) right? correct me If I'm wrong. Also do you know if I need to create any default objects when using p2p for communication? I'm thinking in terms of the server connection channel and Default and Model Queues. |
|
Back to top |
|
 |
StefanSievert |
Posted: Fri Mar 29, 2002 10:14 pm Post subject: |
|
|
 Partisan
Joined: 28 Oct 2001 Posts: 333 Location: San Francisco
|
Quote: |
On 2002-03-29 13:46, Vin wrote:
Stefan,
Thanks so much for making me clear on that. The way to access the transmission queue is QueueManager.accessQueue(QueueName) right? correct me If I'm wrong.
|
Vin,
looks like you need to clarify your setup a bit more... What are your trying to do?
Is your application running on an MQSeries client or a server?
If it is running on a client and you want to access a queue on the server, the queues on that server are considered to be local, because they belong to the queue manager you connect to. If this is the only queue manager in your scenario, you can forget everything I said about remote and transmission queues.
If your application is running on the same machine, where the MQSeries server component is installed, you will connect to the local queue manager. Let's call this queue manager QMGR01. Now, let's say you have a second queue manager called QMGR02, which has a local queue Q02 defined that you want to send messages to. What you have to do on QMGR01 is:
1/ define a transmission queue named QMGR02 (QLOCAL...USAGE(XMITQ))
2/ define a sender channel pointing to QMGR02, named for example QMGR01.QMGR02 and specify 'QMGR02' as the XMITQ attribute of that channel
3/ define a receiver channel QMGR02.QMGR01 to receive messages from QMGR02
4/ define your local definition of the remote queue:
DEFINE QREMOTE(Q02_ON_QMGR02) RNAME(Q02) RQMNAME(QMGR02) XMITQ(QMGR02)
5/ define a local queue for replies from QMGR02:
DEFINE QLOCAL(Q01)
On QMGR02 do the following:
1/ define a transmission queue named QMGR01 (QLOCAL...USAGE(XMITQ))
2/ define a sender channel pointing to QMGR01, named for example QMGR02.QMGR01 and specify 'QMGR01' as the XMITQ attribute of that channel
3/ define a receiver channel QMGR01.QMGR02 to receive messages from QMGR01
4/ define the local queue referenced on QMGR01 above:
DEFINE QLOCAL(Q02)
5/ define your local definition of the remote queue for the replies:
DEFINE QREMOTE(Q01_ON_QMGR01) RNAME(Q01) RQMNAME(QMGR01) XMITQ(QMGR01)
This setup is explained in detail in the Intercommunication Guide.
Now, if you want to send a message to Q02 on QMGR02 from QMGR01:
1/ MQCONN to QMGR01
2/ MQOPEN Q02_ON_QMGR02 (or QueueManager.accessQueue("Q02_ON_QMGR02") )
3/ MQPUT your message(s)
MQSeries will discover that Q02_ON_QMGR02 is the local definition of a remote queue and will add the necessary headers for transmission to your message and put it to the transmission queue QMGR02. If the sender channel to QMGR02 is up and running, the message channel program will get the message from the transmission queue and send it to QMGR02. The receiving message channel agent on QMGR02 will look at the header and see, that the message is destined for the queue Q02 (from the RNAME(Q02) attribute) and will put it to that queue where it can be picked up by any application that is running against QMGR02. This application can then reply using the definitions made on QMGR02 and the reverse process takes place.
You will - under normal circumstances - never directly interact with a transmission queue.
Quote: |
Also do you know if I need to create any default objects when using p2p for communication? I'm thinking in terms of the server connection channel and Default and Model Queues.
|
What do you mean by 'using p2p for communication'?
When you create a (V5.x) queue manager, all necessary MQSeries default and system objects will be created automagically.
If you have a server-server connection, you will not need server connection channels, but sender/receiver or server/requester channel pairs. Server connection channels are for MQSeries client connections only.
Please take some time to read at least the chapters 1 and 2 of the MQSeries Intercommunication guide and - if you use MQ clients - the MQSeries Clients manual. These publications are available online at http://www-3.ibm.com/software/ts/mqseries/library/manualsa/manuals/crosslatest.html
May I also suggest that you start out without using distributed queueing by using just one queue manager to connect and put/get messages on to make yourself familiar with base MQ functionality? Communicating across multiple queue managers introduces a myriad of potential pitfalls, which might quickly discourage you if you are not familiar with how base MQSeries works.
Just a thought.
Good luck,
Stefan
_________________
Stefan Sievert
IBM Certified * MQSeries
[ This Message was edited by: StefanSievert on 2002-03-29 22:17 ] |
|
Back to top |
|
 |
Vin |
Posted: Sun Mar 31, 2002 10:25 pm Post subject: |
|
|
Master
Joined: 25 Mar 2002 Posts: 212 Location: India
|
Stefan,
Thanks so much. This is probably the most comprehensive of examples I can find anywhere. I now have a good understanding of what I need to do. Thanks once again. |
|
Back to top |
|
 |
amigo21 |
Posted: Mon May 06, 2002 2:19 am Post subject: |
|
|
Newbie
Joined: 02 May 2002 Posts: 8
|
Hi,
Thanks for the clear example. In fact I have set up a similar scenario but the message just do not get to the other Queue Manager. What happens is as follows:
When I placed a message on the queue, it gets transfer to the transmission queue but it did not get to the other queue governed by another queue manager. As I've created all the required objects using GUI, and the 2 queue managers are residing on the same machine.
Kindly advise if there is any fault.
Thanks!
Tom
|
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon May 06, 2002 4:55 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Are you saying the messages are stacking up on the transmit queue? If so, and you have done everything Stefan listed above, it sounds like your channel is not started. Either manually start it or enable it for triggering so that it starts automatically whenever a message lands on the XMIT queue.
_________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
StefanSievert |
Posted: Tue May 07, 2002 12:50 pm Post subject: |
|
|
 Partisan
Joined: 28 Oct 2001 Posts: 333 Location: San Francisco
|
If your messages are not on the XMITQ then they will be on the dead letter queue of the receiving queue manager. A corresponding message in the AMQERR01.LOG on the receiving QMgr will tell you about that fact.
Possible reasons for the message to end up on the DLQ:
1/ the queue is not defined on the target queue manager at all
2/ the queue manager name (RQMNAME) in the remote queue definition is not correct
3/ the queue name (RNAME) in the remote queue definition is not correct
4/ there was an authorization problem on the target machine
5/ the target queue was full or PUT(DISABLED) (pretty unlikely)
6/ all or a combination of the above...
If I say 'the name was not correct' I am particularly pointing out that names have to match *exactly*. The Windows GUI does not convert names to uppercase, for example, while RUNMQSC does (unless you use quotes).
Please check your definitions after you have investigated the reason why the message ended up on the DLQ (if it has).
Hope that helps,
Stefan
_________________ Stefan Sievert
IBM Certified * WebSphere MQ |
|
Back to top |
|
 |
|