ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Setting Group Id in the message.....Urgent!!!!

Post new topic  Reply to topic
 Setting Group Id in the message.....Urgent!!!! « View previous topic :: View next topic » 
Author Message
amigupta1978
PostPosted: Wed Feb 13, 2002 4:02 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
StefanSievert
PostPosted: Wed Feb 13, 2002 4:07 pm    Post subject: Reply with quote

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]
&#159; 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
View user's profile Send private message
amigupta1978
PostPosted: Wed Feb 13, 2002 4:29 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
StefanSievert
PostPosted: Wed Feb 13, 2002 5:29 pm    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Amit,
the repository on this forum contains samples. For putting a group, please take a look at http://www.mqseries.net/pafiledb203/pafiledb.php?PHPSESSID=f1e98b2b7e2625e75c1381407fb1d10e&action=viewfile&fid=26&id=2
for getting a group, look at http://www.mqseries.net/pafiledb203/pafiledb.php?PHPSESSID=f1e98b2b7e2625e75c1381407fb1d10e&action=viewfile&fid=22&id=2
HTH,
Stefan

_________________
Stefan Sievert
IBM Certified * WebSphere MQ
Back to top
View user's profile Send private message
amigupta1978
PostPosted: Thu Feb 14, 2002 5:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
Apurva
PostPosted: Fri Feb 15, 2002 4:15 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
mqonnet
PostPosted: Tue Feb 19, 2002 2:33 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Setting Group Id in the message.....Urgent!!!!
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.