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 Java / JMS » How to Group the segmented Messages?

Post new topic  Reply to topic
 How to Group the segmented Messages? « View previous topic :: View next topic » 
Author Message
Krishna_Bhaskar_Vonteddu
PostPosted: Wed Nov 02, 2005 12:37 pm    Post subject: How to Group the segmented Messages? Reply with quote

Novice

Joined: 05 Sep 2005
Posts: 11

Hello Guys,
I have performed Message Segmentation. It is working fine. Now the problem is I want to get the message again as it was in the original state that is it should be grouped(or combined) again. So to do that I have tried the following Snippet of code :

import com.ibm.mq.*;
public class MQGrouping
{
public static void main(String args[]) throws Exception
{

MQEnvironment.hostname = "localhost";
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.port=Integer.parseInt(args[0]);
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
String qManager = args[1];
char GroupStatus=0;
char SegmentStatus=0;
MQQueueManager qMgr;

qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ;
MQQueue queue =qMgr.accessQueue(args[2],openOptions,null,null,null);
MQMessage retrievedMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();

gmo.options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_LOGICAL_ORDER
| MQC.MQGMO_WAIT|MQC.MQGMO_COMPLETE_MSG | MQC.MQGMO_ACCEPT_TRUNCATED_MSG;


while ( (GroupStatus != MQC.MQGS_LAST_MSG_IN_GROUP) ||
(SegmentStatus != MQC.MQSS_LAST_SEGMENT) )
{
queue.get(retrievedMessage, gmo);
}
int count = retrievedMessage.getTotalMessageLength();
byte b[] = new byte[count];
retrievedMessage.readFully(b);
String msgText = new String(b);;
System.out.println("The message is: " + msgText);

queue.close();
qMgr.disconnect();
}
}

Above program is throwing an exception:Reason 2079
i.e., 2079 0x0000081f MQRC_TRUNCATED_MSG_ACCEPTED.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Nov 02, 2005 12:46 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Looks like your buffer is not big enough.

What you are asking is that the payload of x messages be returned as if it were the payload of 1 message.
There are no miracles... For that to happen correctly your retrieving buffer / channel /... must allow for the max size of the group...
Back to top
View user's profile Send private message Send e-mail
wschutz
PostPosted: Wed Nov 02, 2005 12:48 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

What happens if you don't specify MQC.MQGMO_ACCEPT_TRUNCATED_MSG?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
Krishna_Bhaskar_Vonteddu
PostPosted: Wed Nov 02, 2005 12:52 pm    Post subject: Reply with quote

Novice

Joined: 05 Sep 2005
Posts: 11

Hai fjb_saper,
how to max the sizes of the fields like buffer/channel... through the program.
Back to top
View user's profile Send private message
Krishna_Bhaskar_Vonteddu
PostPosted: Wed Nov 02, 2005 12:58 pm    Post subject: Reply with quote

Novice

Joined: 05 Sep 2005
Posts: 11

hai wschutz,we have to specify MQC.MQGMO_ACCEPT_TRUNCATED_MSG this field ,if not we will get 2010 reason code as exception which is
MQRC_DATA_LENGTH_ERROR .
thanx.
Back to top
View user's profile Send private message
wschutz
PostPosted: Wed Nov 02, 2005 1:03 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

I see, how big are the segmented messages? Are they larger than 4M? If so, you'll run into a problem with the max msg size on your SYSTEM.DEF.SVRCONN channel definition.

EDIT: actually, I see you are connecting to "localhost". Can you use the server bindings instead of the client bindsings and try again?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
EddieA
PostPosted: Wed Nov 02, 2005 1:13 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
Above program is throwing an exception:Reason 2079
i.e., 2079 0x0000081f MQRC_TRUNCATED_MSG_ACCEPTED.

I dont see why you should ever get that:
Quote:
queue.get(retrievedMessage, gmo);
Quote:
public void get(MQMessage message, MQGetMessageOptions getMessageOptions) throws MQException;
Retrieves a message from the queue, regardless of the size of the message. For large messages, this might require two calls to WebSphere MQ, One to establish the required buffer size and one to get the message data itself.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed Nov 02, 2005 1:18 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
I see, how big are the segmented messages? Are they larger than 4M? If so, you'll run into a problem with the max msg size on your SYSTEM.DEF.SVRCONN channel definition.

I didn't think that restriction applied to Java.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed Nov 02, 2005 1:25 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

And lastly, which are you using Segmentation or Grouping. They are not the same thing.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
wschutz
PostPosted: Wed Nov 02, 2005 4:07 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Hi Ed:
Quote:
(2010)
Explanation:

The DATLEN parameter is not valid. ... usual about buffers ....
Programmer Response:

Correct the parameter.

If the error occurs for an MQ client program, also check that the maximum message size for the channel is big enough to accommodate the message being sent; if it is not big enough, increase the maximum message size for the channel.

Quote:
I didn't think that restriction applied to Java.

Why wouldn't it? The default for SYSTEM.DEF.SVRCONN is MAXMSGL(4194304). Also, the default client end of the channel would have the same value.

So, back to my last post ....Krishna_Bhaskar_Vonteddu: can you try a smaller segmented message or server bindings?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
EddieA
PostPosted: Wed Nov 02, 2005 4:58 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Hey Wayne,
Quote:
The default for SYSTEM.DEF.SVRCONN is MAXMSGL(4194304)

Yeah, but you can increase it.

The "restriction", I was referring to was when a client channel is "defined" by the MQSERVER environment setting, then it has a max. MSGLEN of 4M, even if the value in the SVRCONN channel is bigger. With a Java client, it uses the value in the SVRCONN, with no restrictions.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Krishna_Bhaskar_Vonteddu
PostPosted: Thu Nov 03, 2005 6:12 am    Post subject: Reply with quote

Novice

Joined: 05 Sep 2005
Posts: 11

Hai Eddie I have increased the length of the SYSTEM.DEF.SVRCONN channel. But using the above code and running it, it is going into infinite loop.
thanx
Back to top
View user's profile Send private message
wschutz
PostPosted: Thu Nov 03, 2005 9:50 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

How do you know its looping? Also, do you specify a waitinterval? (I don't see any in the code).
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
Krishna_Bhaskar_Vonteddu
PostPosted: Thu Nov 03, 2005 11:03 am    Post subject: Reply with quote

Novice

Joined: 05 Sep 2005
Posts: 11

wschutz, specifically I too dont know the reason why it is doing so. But this is not the first time I have faced this problem. I came across this first time when 'I want to read the messages from a queue using a java program which are segmented using 'rfutil' '. That program runs fine when Iam trying to read the messages which are kept normally(not using segmentation technique).
Please solve this problem and grouping.
Cheers.
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Nov 03, 2005 4:09 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

EddieA wrote:
And lastly, which are you using Segmentation or Grouping. They are not the same thing.

Cheers,

You are mixing the options for these. If you are using Segmentation, you should not be checking for: MQGS_LAST_MSG_IN_GROUP.

You also say: MQGMO_COMPLETE_MSG which means MQ will re-assemble the message, so why are you checking this: .MQSS_LAST_SEGMENT. Also, you should not be checking for this if you are only using Grouping.

I suggest you read up on Grouping and Segmenting, and the differences between them.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to Group the segmented Messages?
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.