|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
DistributionList and MessageId retrieval problem |
« View previous topic :: View next topic » |
Author |
Message
|
Genie |
Posted: Mon Oct 28, 2002 3:57 am Post subject: DistributionList and MessageId retrieval problem |
|
|
Newbie
Joined: 28 Oct 2002 Posts: 1
|
Hello,
I have been spilling my blood for last two weeks trying to get this thing to work.
Problem: I have distribution list, and I want to retrieve messageId when I put message on the queue but all I get are bunch of squares instead of messageId. Retrieving messageId when I'm not using distributionList is easy and I do get it.. BUT this distributionList.put thing is NOT returning messageId. I have played with recordFields, all kind of options, searched web from east to west, been on IBM web site, read all Redbooks but nothing! Few words on distributionLists and that is that.. so please help.
Tx....
---------------
Here comes the code:
import com.ibm.mq.*;
public class DistributionList
{
private static String qMgrName = "QM1";
private static String qName = "Q1";
private static String qDist1Name = "Q1";
private static String qDist2Name = "Q2";
private static MQQueue outQueue;
private static MQDistributionList distList;
public DistributionList()
{
super();
}
public static void main(String[] args)
{
try
{
System.out.println("Start of BasicPut");
DistributionList distributePut = new DistributionList();
MQQueueManager qMgr = new MQQueueManager(qMgrName);
System.out.println("Connected to Queue Manager " + qMgrName);
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING;
MQDistributionListItem[] distributionListItem = new MQDistributionListItem[2];
for (int i=0; i<2; ++i) {
distributionListItem[i] = new MQDistributionListItem();
}
distributionListItem[0].queueName = qDist1Name;
distributionListItem[1].queueName = qDist2Name;
distList = qMgr.accessDistributionList(distributionListItem, openOptions);
System.out.println("Distribution List has been opened\n");
// Call method to get orders and distribute them
distributePut.distribute();
String Z = new String(distributionListItem[0].messageId);
System.out.println("MSGID1 is " + Z);
String W = new String(distributionListItem[1].messageId);
System.out.println("MSGID2 is " + W);
// close the distribution list
distList.close();
System.out.println("Distribution List has been closed");
// disconnect from Queue Manager
qMgr.disconnect();
System.out.println("Disconnected from Queue Manager " + qMgrName);
System.out.println("End of BasicPut\n");
}
catch (MQException ex) {
System.out.println("An MQ error occured: Completion code " +
ex.completionCode + " Reason code " + ex.reasonCode);
}
}
private void distribute() {
try {
//Build the message
MQMessage outMsg = new MQMessage();
//Set the message format
outMsg.format = MQC.MQFMT_STRING;
//Set the message content
String msgString = "Test Message from BasicPut Program";
outMsg.writeString(msgString);
//Set the put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();//?????
pmo.options = MQC.MQPMO_NEW_MSG_ID;
pmo.recordFields = MQC.MQPMRF_MSG_ID;
//Put the message on the distribution list
distList.put(outMsg,pmo);
System.out.println("The message has been put on the distribution list");
}
catch (MQException ex) {
System.out.println("An MQ error occured: Completion code " +
ex.completionCode + " Reason code " + ex.reasonCode);
}
catch (java.io.IOException e) {
System.out.println("An error occured writing to the message " +
"buffer " + e);
}
}
} |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Dec 05, 2002 5:56 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Better late than never....I couldn't get this to work either. It ended up being APAR IC35037. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|