|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
MQOD cannot be supplied to MQDistributionList - MQ 2154 err |
« View previous topic :: View next topic » |
Author |
Message
|
wschutz |
Posted: Tue Nov 22, 2005 11:19 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
I'd go with Jeff's suggestion to create an MQDistributionList object instead of using the qmgr's. method.... _________________ -wayne |
|
Back to top |
|
 |
ivanachukapawn |
Posted: Tue Nov 22, 2005 11:21 am Post subject: |
|
|
 Knight
Joined: 27 Oct 2003 Posts: 561
|
wshutz
I already tried that constructor. It didn't make any difference.
JD |
|
Back to top |
|
 |
wschutz |
Posted: Tue Nov 22, 2005 11:50 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Okay, I did a quick test here (Linux and 6.0.1 qmgr) and both methods
work fine as both client and server bindings .....  _________________ -wayne |
|
Back to top |
|
 |
wschutz |
Posted: Thu Nov 24, 2005 3:37 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
For future reference, here's the code that works on my machine:
Code: |
import com.ibm.mq.*; //Include the WebSphere MQ classes for Java package
public class MQSample {
// define the name of the QueueManager
private static final String qManager = "WSCHUTZ";
// main method: simply call the runSample() meth
public static void main(String args[]) {
new MQSample().runSample();
}
public void runSample() {
try {
MQEnvironment.hostname="localhost";
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.port = 1414;
// Create a connection to the QueueManager
System.out.println("Connecting to queue manager: "+qManager);
MQQueueManager qMgr = new MQQueueManager(qManager);
MQDistributionListItem[] dil = new MQDistributionListItem[2];
MQDistributionListItem li1 = new MQDistributionListItem();
li1.queueName = "TEST.1";
dil[0] = li1;
MQDistributionListItem li2 = new MQDistributionListItem();
li2.queueName = "TEST.2";
dil[1] = li2;
// Set up the options on the queue we wish to open
int openOptions = MQC.MQOO_OUTPUT;
MQDistributionList dl = qMgr.accessDistributionList( dil, openOptions);
// Define a simple WebSphere MQ Message ...
MQMessage msg = new MQMessage();
// ... and write some text in UTF8 format
msg.writeString("Hello, World!");
// Specify the default put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put the message to the queue
System.out.println("Sending a message...");
dl.put(msg, pmo);
MQDistributionList d2 = qMgr.accessDistributionList( dil , openOptions );
System.out.println("Sending a message...");
msg.writeString("and Hello, Mars!");
d2.put(msg, pmo);
// Disconnect from the QueueManager
System.out.println("Disconnecting from the Queue Manager");
qMgr.disconnect();
System.out.println("Done!");
}
catch (MQException ex) {
System.out.println("A WebSphere MQ Error occured : Completion Code "
+ ex.completionCode + " Reason Code " + ex.reasonCode);
}
catch (java.io.IOException ex) {
System.out.println("An IOException occured whilst writing to the message buffer: "
+ ex);
}
}
}
|
_________________ -wayne |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Nov 24, 2005 10:16 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
wschutz wrote: |
Code: |
new MQSample().runSample(); |
|
Looks like someone is using the lastest release of Eclispe.
Wayne, can I post your code on my web site?
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
wschutz |
Posted: Fri Nov 25, 2005 4:53 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Sure Roger, feel free.... _________________ -wayne |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|