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 » General Discussion » help with putting a pdf on MQ queue

Post new topic  Reply to topic
 help with putting a pdf on MQ queue « View previous topic :: View next topic » 
Author Message
anveshita
PostPosted: Wed Jun 18, 2008 10:38 am    Post subject: help with putting a pdf on MQ queue Reply with quote

Master

Joined: 27 Sep 2004
Posts: 254
Location: Jambudweepam

I need help with putting a pdf on MQ queue. Could you please review hte following snippet and let me know if I am on the right track
------------------------
//Set up the MQEnvironment properties for Client Connections
MQEnvironment.hostname = hostName ;
MQEnvironment.channel = channel ;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
MQQueueManager qMgr = new MQQueueManager(qManager) ;
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING ;
//Open the queue
MQQueue queue = qMgr.accessQueue(qName,openOptions, null,null,null);
// Set the put message options , we will use the default setting.
MQPutMessageOptions pmo = new MQPutMessageOptions();


MQMessage outMsg = new MQMessage();
outMsg.format = MQC.MQFMT_NONE

// Read the PDF file to input stream
BufferedInputStream in = new BufferedInputStream(new FileInputStream("c:\\test.pdf"));
while ((len = in.read(buf)) >= 0) {
outMsg.write(buf,0,len);
}

// Now we put The message on the Queue
queue.put(outMsg, pmo);
-------------------
I am unable to test as MQ as I do not have access to the queue. But wanted to have the code ready before.
Thanks
Back to top
View user's profile Send private message
AkankshA
PostPosted: Wed Jun 18, 2008 10:04 pm    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

i fear we might not be able to review...

we all have learnt here by doing it...

how about getting the trial version of MQ from IBM portal and testing it yourself.... and then if u face any error then we would love to be with you in resolution of the same....
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
Gaya3
PostPosted: Wed Jun 18, 2008 10:26 pm    Post subject: Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

where is the error handling scenario in your code?

are you segmenting the messages?
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Wed Jun 18, 2008 11:41 pm    Post subject: Reply with quote

Jedi Knight

Joined: 25 Mar 2003
Posts: 2538
Location: Melbourne, Australia

You need to read the entire PDF contents as one binary record into a buffer (allocated with the same size as the file), and then put the buffer as a message on a MQ queue.
_________________
Glenn
Back to top
View user's profile Send private message
bruce2359
PostPosted: Thu Jun 19, 2008 6:47 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9469
Location: US: west coast, almost. Otherwise, enroute.

Quote:
I am unable to test as MQ as I do not have access to the queue. But wanted to have the code ready before.

It is unrealistic to expect that untested code will work. Create a test qmgr; then test your program.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
ucbus1
PostPosted: Thu Jun 19, 2008 11:44 am    Post subject: Reply with quote

Knight

Joined: 30 Jan 2002
Posts: 560

I guess you are in luck. I happened to address this issue sometime back. I can send you the sample which I created if you are interested. I am not posting here the code as it is a barebones code with flaky error handling. If it works for you then you may post
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » help with putting a pdf on MQ queue
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.