Author |
Message
|
Varun |
Posted: Mon May 05, 2008 7:20 pm Post subject: Use .NET to send message to MQ Cluster |
|
|
Newbie
Joined: 01 May 2008 Posts: 2
|
Apologies if this has been asked before. I am a MQSeries newbie. I have been entrusted the task of evaluating MQSeries /Web MQ vis as vis MSMQ. I have setup the following -
2 virtual machines with windows 2003 + Websphere MQ 6.0 trial version. I have also configured the Web MQ servers as a cluster. Both the machines act as full repositories.
I have been able to send a message using .NET/C# code to a non clustered queue on a single machine. Can anyone please point me to some sample code which I can use connect/send message to a shared/clustered queue. I am hoping that a shared clustered queue across machines acts as a single queue. If a particular machine would fail, the active machine would carry on processing. Moreover, it would pick up the messages which had been sent to the failed machine.
Any sample code/comments/validation of my assumptions would be helpful. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon May 05, 2008 8:14 pm Post subject: Re: Use .NET to send message to MQ Cluster |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Varun wrote: |
I have been able to send a message using .NET/C# code to a non clustered queue on a single machine. Can anyone please point me to some sample code which I can use connect/send message to a shared/clustered queue. I am hoping that a shared clustered queue across machines acts as a single queue. If a particular machine would fail, the active machine would carry on processing. Moreover, it would pick up the messages which had been sent to the failed machine.
Any sample code/comments/validation of my assumptions would be helpful. |
This is not the way MQ behaves. You seem to be mixing several concepts.
WAS clusters with JMS Engine can behave the way you want on the SI Bus.
You need to remember that MQ Clustering is there for load balancing. If you need High Availability (HA) you need some kind of hardware clustering... (HACMP and other options depending on OS...)
And by the way here is the golden rule in MQ:
You can only get a message from a queue that is local (as in ql) to a qmgr you are connected to...
There is a good library of materials on line and even a cluster manual
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Varun |
Posted: Mon May 05, 2008 8:49 pm Post subject: Thanks. Have some more questions |
|
|
Newbie
Joined: 01 May 2008 Posts: 2
|
As far as I understand the following -
Web MQ Clustering - Load Balancing.
Hardware clustering - High Availability. For example - using Microsoft clustering service on Windows 2003 Enterprise edition.
Messages can be picked up only from local queues/queue manager one is connected to.
This would mean the following -
Message can be sent to a shared/clustered queue. This shared queue automatically balances the load across multiple machines.
Questions -
Does the MQ cluster balances connections or messages. For example - if I send 1000 messages at a MQ cluster of 2 machines, will 500 messages be automatically sent to each queue.
So far the only .NET code I came across connects to a particular queue manager and sends the messages to a queue on the same. Will the code for sending messages to the clustered queue be the same. Shouldn't there be some code in which we should not have to specify the queue manager name as explicitly defining the queue manager name/host name etc ties us to a specific machine.
Any links to samples/code would be most helpful.
Thanks so much in advance. |
|
Back to top |
|
 |
Vitor |
Posted: Tue May 06, 2008 12:42 am Post subject: Re: Thanks. Have some more questions |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Varun wrote: |
Message can be sent to a shared/clustered queue. This shared queue automatically balances the load across multiple machines.
|
Not strictly. The queues are not shared, but the queue managers will determine which of the discrete queues will receive the message.
Varun wrote: |
Does the MQ cluster balances connections or messages. For example - if I send 1000 messages at a MQ cluster of 2 machines, will 500 messages be automatically sent to each queue. |
All connections are to a given queue manager. Messages are balanced, and by default go round robin between each of the possible targets. If you have 1000 messages and 2 possible targets, you'd get 500ish on each (though they'd all go somewhere). If you added a third queue, you'd get 333ish on each.
WMQv6 allows you to configure this distribution, provided all queue managers in the cluster are v6. Note also that by default, if you connect to a queue manager that hosts a possible target, all the messages will go to that.
Varun wrote: |
So far the only .NET code I came across connects to a particular queue manager and sends the messages to a queue on the same. Will the code for sending messages to the clustered queue be the same. |
Yes
Varun wrote: |
Shouldn't there be some code in which we should not have to specify the queue manager name as explicitly defining the queue manager name/host name etc ties us to a specific machine.
|
No. All applications connect to a specific queue manager, which may or may not participate in a cluster.
There are various techniques for making the connection less specific, which have nothing to do with clusters and might not be approriate to your situation. Check the Clients manual. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue May 06, 2008 6:45 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9472 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
Can anyone please point me to some sample code which I can use connect/send message to a shared/clustered queue. ...I am hoping that a shared clustered queue across machines acts as a single queue. ...If a particular machine would fail, the active machine would carry on processing. |
Shared Queues is a z/OS (mainframe) WMQ implementation; and a wonderful thing it is. Shared Queues provide exactly what you are looking for, namely: if a qmgr fails, other qmgr(s) can process the message. Shared queues have nothing to do with clustered queues.
In z/OS, an application can connect to a qmgr OR a queue-sharing group (of qmgrs). For other platforms, an application must connect to a qmgr in order to put/get a message. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Vitor |
Posted: Tue May 06, 2008 7:13 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bruce2359 wrote: |
Shared Queues is a z/OS (mainframe) WMQ implementation; and a wonderful thing it is. Shared Queues provide exactly what you are looking for, namely: if a qmgr fails, other qmgr(s) can process the message. Shared queues have nothing to do with clustered queues.
In z/OS, an application can connect to a qmgr OR a queue-sharing group (of qmgrs). For other platforms, an application must connect to a qmgr in order to put/get a message. |
I think it's wrong to taunt a poster who's admitted he's condemed to use Windoze with the glory that is z/OS.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue May 06, 2008 7:19 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9472 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
I think it's wrong to taunt a poster ... |
Not my intent. If Varun's organization has a business requirement that demands what WMQ for z/OS provides, then it's not taunting.
All platforms have their benefits. z/OS has a few more. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Tue May 06, 2008 9:20 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
bruce2359 wrote: |
Shared queues have nothing to do with clustered queues. |
Although you can cluster shared queues.  _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue May 06, 2008 10:02 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9472 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
Although you can cluster shared queues. |
On a mainframe all things are possible. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 07, 2008 1:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bruce2359 wrote: |
On a mainframe all things are possible. |
It's so, so beautiful.....
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|