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 » Segmentation in Java

Post new topic  Reply to topic
 Segmentation in Java « View previous topic :: View next topic » 
Author Message
naylak
PostPosted: Fri Feb 27, 2004 7:46 am    Post subject: Segmentation in Java Reply with quote

Apprentice

Joined: 08 Feb 2003
Posts: 47

Hi All!

I have written the following piece of code . I want to put a big message in a queue. So I am going for segmentation. As far as I understood segmentation I have written the following piece of code and tested it. I am getting reason code 2253 which means my offset is 0. I have changed the value but I am still getting it as can be seen in the code.



_____________________________________________________________


import com.ibm.mq.*;
import java.io.*;
public class MQPut
{
public static void main(String args[]) throws Exception
{
System.out.println("MQPutDemo started...");

MQQueueManager qMgr = new MQQueueManager("CBINBRQM");
String queueName = "CBINGWQ";
MQMessage myMessage = new MQMessage();
myMessage.messageFlags = MQC.MQMF_SEGMENT;
myMessage.offset = 1024;

MQPutMessageOptions pmo1 = new MQPutMessageOptions();
pmo1.options = pmo1.options|MQC.MQPMO_LOGICAL_ORDER|MQC.MQPMO_SET_IDENTITY_CONTEXT | MQC.MQPMO_SYNCPOINT ;
int openOptions = MQC.MQOO_OUTPUT | MQC.MQPMO_SET_IDENTITY_CONTEXT ;
MQQueue myQueue = qMgr.accessQueue(queueName ,openOptions,null,null,null);


File f = new File("demo.zip");
FileInputStream fis = new FileInputStream("Installation Manual-Branch.doc");
long length = f.length();
byte[] bts = new byte[(int)length];
fis.read(bts);
fis.close();

myMessage.write(bts);

myQueue.put(myMessage, pmo1);
myQueue.close();
qMgr.disconnect();
}
}

_____________________________________________________________
Back to top
View user's profile Send private message
mqonnet
PostPosted: Fri Feb 27, 2004 8:27 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

Looking at your code it looks like you are little confused as to how you should be segmenting.

Segmentation is achieved in either of the 2 ways. Application does it, or the queue manager does it. In your case you seem to have coded for your app to do it. But you are just putting 1 segment.

If you plan on puttin a large message such as a file and segment it, either break the file into pieces and put them individually taking care of segmentation. Or else, leave this job for the queue manager to take care for you by just specifying MQMF_SEGMENTATION_ALLOWED in your md.

Hope this helps.

Cheers
Kumar
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 Java / JMS » Segmentation in Java
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.