Author |
Message
|
amigupta1978 |
Posted: Wed Feb 13, 2002 4:02 pm Post subject: |
|
|
Centurion
Joined: 22 Jan 2002 Posts: 132 Location: India
|
Hi,
Can I explicitly set the Group Id in the MQMD. I have written one sample program to do this. (I am basically setting the GroupId of the MQMD and the seuenceNo of the Message and the MSG_IN_GROUP flag...and for the last message I set the LAST_MSG_IN_GRP flag keeping the Group Id same in all the messages and changing the sequence number 1,2 and so on respectively for the different messages)
But the problem is that when I am retreing the Message using the MQGet command with the MQGMo.options set to MQC.MQGMO_ALL_MSGS_AVAILABLE then I am getting the error 2241...Incomplete Message Group.
(But I have checked in the MQSeries Explorer that all the messages had their GroupId set properly, Seuence number set properly and the LAST_Message in the Group is also set in the last message) Cud any one pls tell me what I am doing wrong here...
I am attaching my code here...
Thanks in Advance
Regards
Amit
import java.util.*;
import java.io.*;
import com.ibm.mq.*;
public class WriteQGroup
{
public static void main(String[] args) throws Exception
{
MQQueueManager _queueManager = null;
String qManager = "TESTAMIT";
if (args.length<2)
{
// 0 1 2 3 4
System.out.println("usage WriteQGroup queuename filename Group msgseqno last");
return;
}
String str=args[1];
FileInputStream fis = null;
File ff=new File(str);
int lenfile=(int)ff.length();
fis = new FileInputStream(ff);
byte[] b=new byte[lenfile];
fis.read(b);
str=new String(b);
System.out.println("string is '" + str+"'");
String outputQName=args[0];
String groupId=args[2];
int seqNo= Integer.parseInt(args[3]);
boolean lastMsg= false;
if (args[4].charAt(0)=='Y') lastMsg=true;
try
{
_queueManager = new MQQueueManager(qManager);
}
catch (Exception ex)
{
System.out.println("string is "+ qManager);
ex.printStackTrace();
}
//_queueManager = new MQQueueManager();
int openOptions = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;
MQQueue queue = _queueManager.accessQueue( outputQName,
openOptions,
null, // default q manager
null, // no dynamic q name
null ); // no alternate user id
// Define a simple MQ message, and write some text in UTF format..
MQMessage sendmsg = new MQMessage();
sendmsg.format = MQC.MQFMT_STRING;
sendmsg.feedback = MQC.MQFB_NONE;
sendmsg.messageType = MQC.MQMT_DATAGRAM;
sendmsg.setVersion(MQC.MQMD_VERSION_2);
sendmsg.replyToQueueManagerName = qManager;
sendmsg.correlationId = MQC.MQCI_NONE;
sendmsg.groupId = groupId.getBytes();
sendmsg.messageSequenceNumber = seqNo;
if (lastMsg == true)
{
sendmsg.messageFlags=MQC.MQMF_MSG_IN_GROUP + MQC.MQMF_LAST_MSG_IN_GROUP;
}
else
sendmsg.messageFlags=MQC.MQMF_MSG_IN_GROUP;
sendmsg.writeString(str);
MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the defaults, same
pmo.options= MQC.MQPMO_LOGICAL_ORDER;
queue.put(sendmsg, pmo);
queue.close();
_queueManager.disconnect();
}
}
|
|
Back to top |
|
 |
StefanSievert |
Posted: Wed Feb 13, 2002 4:07 pm Post subject: |
|
|
 Partisan
Joined: 28 Oct 2001 Posts: 333 Location: San Francisco
|
From the MQSeries Messages manual on MQRC 2241:
MQRC_INCOMPLETE_GROUP
| Message group not complete.
| An operation was attempted on a queue using a queue handle that had an incomplete
| message group. This reason code can arise in the following situations:
[snip]
Ÿ On the MQGET call, when the application attempts to get a message which is not the
| next one in the group, does not specify MQGMO_LOGICAL_ORDER, but the previous
| MQGET call for the queue handle did specify MQGMO_LOGICAL_ORDER. The call
| succeeds with completion code MQCC_WARNING in this case.
[snip]
Can you verify that you specified MQGMO_LOGICAL_ORDER consistently in your retrieving code?
Stefan
_________________ Stefan Sievert
IBM Certified * WebSphere MQ |
|
Back to top |
|
 |
amigupta1978 |
Posted: Wed Feb 13, 2002 4:29 pm Post subject: |
|
|
Centurion
Joined: 22 Jan 2002 Posts: 132 Location: India
|
Hi,
Thnx for reply..
I have one query what exactly MQSeries say as the Group. What I think that it must be checking the GroupID field in the MQMD and that shud end when it sees the LAST_MSG_IN_GROUP set message.So what I am expecting that my different MQGet calls shud receive me the different message in the group till it sees the LAST_MSG_IN_GROUP
I am not using the logical_order flag in my MQGET options...
Let me explain the scenario...I have put application which put differenr logical messages in the group with seqno 1 and 2
I have a receving application from which I want to get the messages when all are avilable so I am using there in MQGMO_ALLMSGS_AVILABLE options. When the MQGet runs for the first time it gets the first message out of the group but after wards it either give me the error 2241 (if I set the MGMO_LOGICAL_ORDER though I dont care about the logical order ) or says 2033 no_msg avilable. (SInce the thing is Mgget had already picked out the first message from that group with the sequence number 1 ) so it didnot pick up the next message thus leaving in my queue the second message with seqno 2.
Can u pls snd me some sample code to put the message in the group and then to retrieve it...
Thnx
Amit |
|
Back to top |
|
 |
StefanSievert |
Posted: Wed Feb 13, 2002 5:29 pm Post subject: |
|
|
 Partisan
Joined: 28 Oct 2001 Posts: 333 Location: San Francisco
|
|
Back to top |
|
 |
amigupta1978 |
Posted: Thu Feb 14, 2002 5:47 pm Post subject: |
|
|
Centurion
Joined: 22 Jan 2002 Posts: 132 Location: India
|
thnx for the reply,
I have seen the code at the site.
But the thing that I want is that
1) I shud be able to set the GroupId (2) I shud be able to set the message sequence number. (These programs use the MQPMO_LOGICAL_ORDER option)
I have one query what exactly MQSeries say as the Group. What I think that it must be checking the GroupID field in the MQMD and that shud end when it sees the LAST_MSG_IN_GROUP set message.
So what I am expecting that my different MQGet calls shud receive me the different message in the group till it sees the LAST_MSG_IN_GROUP, when I get the messages using the MQGMO_ALL_MESSAGE_AVILABLE (since I dont care abt the logical order)
Can somebody pls correct me if my assumption is wrong? and can anybody please look at the code which I have sent with an eralier message...
Thanks in Advance
Amit |
|
Back to top |
|
 |
Apurva |
Posted: Fri Feb 15, 2002 4:15 am Post subject: |
|
|
Newbie
Joined: 14 Feb 2002 Posts: 4 Location: India
|
Hello Everyone !!!
I am a newbie to IBMMQSeries and my team is working On this with the Interface being developed in VB + ASP. I am able to set the client and also able to connect to the server using the IBM examples. We are also able to send the message across with messageid being defined, now while retriving the data I am setting the correlation id to the same messageid where I am getting the error code 2033 that is "No message available" can anyone please guide me, in "How to retrieve the data for the message posted ???"
Thanks in advance...
It will be very kind if any of u guys do post the reply here and/or mail it to my id.........
Apurva |
|
Back to top |
|
 |
mqonnet |
Posted: Tue Feb 19, 2002 2:33 pm Post subject: |
|
|
 Grand Master
Joined: 18 Feb 2002 Posts: 1114 Location: Boston, Ma, Usa.
|
Hi Amit,
Could you show me the output of AMQSBCG for the messages which are put after this app ends. Bear in mind that you have md V2 fields, group id, msn and others.
Also, are you using amqsget or your custom built app to retrieve the messages.
Cheers.
Kumar
_________________ IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator |
|
Back to top |
|
 |
|