Author |
Message
|
vandana |
Posted: Wed Dec 05, 2001 8:15 pm Post subject: |
|
|
Acolyte
Joined: 01 Dec 2001 Posts: 74
|
How do i associate a DistributionListItem
with a queue using the MQSet Method??
What is the advantage of using DIstributionLists??
|
|
Back to top |
|
 |
middlewareonline |
Posted: Fri Dec 07, 2001 8:27 am Post subject: |
|
|
Acolyte
Joined: 09 Jul 2001 Posts: 73
|
Distribution List is associated using MQOPEN(). Using distribution list you can send same message to multiple queues in one PUT call. If you had to this w/o distribution list you would open each queue, do a put, and close.
Rajesh
_________________ ---------------------------------------------
IBM & SUN (J2EE) Certified Consultants,
http://www.MiddlewareOnline.com
A "SARVAM" Online Portal
http://www.SARVAM.com
--------------------------------------------- |
|
Back to top |
|
 |
vandana |
Posted: Fri Dec 07, 2001 9:39 pm Post subject: |
|
|
Acolyte
Joined: 01 Dec 2001 Posts: 74
|
I'm working on nt 4.0 using java.
How is the association done in this case? |
|
Back to top |
|
 |
abmanesh |
Posted: Mon Dec 10, 2001 8:28 am Post subject: |
|
|
Apprentice
Joined: 06 Nov 2001 Posts: 39
|
Hi,
Here is a code snippet for working with distribution lists using MQSeries Java API.
String qManager = "SIDPCB328.QMGR1" ;
String hostName = "SIDPCB328";
String channel = "SIDPCB328.CLIENT" ;
String userId = "xxx" ;
int openOptions = MQC.MQOO_OUTPUT;
MQEnvironment.hostname = hostName ;
MQEnvironment.channel = channel ;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
MQQueueManager qMgr = new MQQueueManager(qManager) ; // Obtain QueueManager
// Create an array of MQDistributionListItem objects. Size of the array is determined by the
// number of destination queues.
MQDistributionListItem[] items = new MQDistributionListItem[3];
// Create the individual items of the distribution list
MQDistributionListItem item1 = new MQDistributionListItem();
MQDistributionListItem item2 = new MQDistributionListItem();
MQDistributionListItem item3 = new MQDistributionListItem();
// Set the properties of the Individual Items.
item1.queueManagerName = "SIDPCB328.QMGR1";
item1.queueName = "QUEUE1";
item2.queueManagerName = "SIDPCB328.QMGR1" ;
item2.queueName = "QUEUE2" ;
item3.queueManagerName = "SIDPCB328.QMGR1" ;
item3.queueName = "QUEUE3" ;
// Populate the items array with the individaual items
items[0] = item1;
items[1] = item2;
items[2] = item3;
// Create a DistributionList object with the items.
MQDistributionList testDistribution = new MQDistributionList(qMgr, items,openOptions, userId);
MQMessage outMsg = new MQMessage();
MQPutMessageOptions pmo = new MQPutMessageOptions();
outMsg.writeString("This is a test message from Distribution List Application"); // Create a test message
testDistribution.put(outMsg, pmo); // Send message to the distribution list.
qMgr.commit();
testDistribution.close();
qMgr.disconnect(); |
|
Back to top |
|
 |
vandana |
Posted: Mon Dec 10, 2001 10:18 pm Post subject: |
|
|
Acolyte
Joined: 01 Dec 2001 Posts: 74
|
thanks abmanesh !!!!.
the code was of great help.
Is it that we can put messges into
the queues of a single QueueManager?
In what scenario would one use a distributionList?
|
|
Back to top |
|
 |
vandana |
Posted: Tue Dec 11, 2001 12:14 am Post subject: |
|
|
Acolyte
Joined: 01 Dec 2001 Posts: 74
|
abmanesh what i sthe significance
of userid here?
where do we create it? |
|
Back to top |
|
 |
abmanesh |
Posted: Tue Dec 11, 2001 3:34 pm Post subject: |
|
|
Apprentice
Joined: 06 Nov 2001 Posts: 39
|
Hi,
A distribution list can consist of queues on more than one queue manager. You specify the Queue Name and the Queue Manager Name of each item when you create the individual item.
The MQDistributionList class has only one constructor and it requires an alternate user id. This user id is used to validate the read/write previleges on the list of queues in the distribution list. There is no userid/password authentication on the userid you specify. The specified user id should have the required previleges within MQ.
About the use, it is similar to a cc list you would use in an e-mail when you want to send same message to multiple recipient. Or kind of faking a Publish model where you are publishing the same information to multiple subscribers without the complexity of a broker.
|
|
Back to top |
|
 |
vandana |
Posted: Tue Dec 11, 2001 9:36 pm Post subject: |
|
|
Acolyte
Joined: 01 Dec 2001 Posts: 74
|
hi abmanesh,
but an application can connect to only one queuemanager at a time.
And the distribution list takes the name
of this queuemanager as a parameter.
how could we associate a single distribution
list with queue's of diffrerent queuemanagers?
thanks
vandana
|
|
Back to top |
|
 |
abmanesh |
Posted: Wed Dec 12, 2001 4:29 pm Post subject: |
|
|
Apprentice
Joined: 06 Nov 2001 Posts: 39
|
There is not much detailed documentation on Distribution lists. How we have used it is to have remote queue definitions of the queues (that are not local to the queue manager you are connecting to) on the local queue manager.
The documentation of the sample program amqsptl0 , leads you down a path that you could associate queus on different queue managers directly. |
|
Back to top |
|
 |
EddieA |
Posted: Wed Dec 12, 2001 5:07 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Doing that defeats one of the objects of Distribution Lists. If you have multiple destination queues on the same remote Queue Manager, then when you use a Distribution List, MQ only sends one message down the channel and puts copies on each Queue at the destination end. Using your technique, you would send multiple copies of the message down the channel.
Also, MQ is smart enough to know if the Queue Manager at the receiving end of a channel supports Distribution Lists and if it doesn't, then the sending MCA will send multiple messages, one to each destination queue.
Cheers,
_________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
|