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 » putting a file onto a queue

Post new topic  Reply to topic
 putting a file onto a queue « View previous topic :: View next topic » 
Author Message
garymach64
PostPosted: Mon Apr 30, 2007 3:54 am    Post subject: putting a file onto a queue Reply with quote

Newbie

Joined: 30 Apr 2007
Posts: 1

My goal is to be able to put a message on the queue that is contained in a file on the disk.
I can do it with a
amqsput MyQueueName < c:\gary\mq\text.txt
command.
However, each new line is separated into a new message on the queue. Can I make them all into a single message?

Thanks in advance,
Gary
_________________
Gary Machol
Software Engineer


Last edited by garymach64 on Mon Apr 30, 2007 4:12 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Vitor
PostPosted: Mon Apr 30, 2007 4:05 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

There have been a number of discussions on this subject - the Search button (top right this page) will be your friend here.

There's no single API to do it, but there are commerical products that provide this functionality and might be better than reinventing a wheel. It's not as straightforward as it first appears.

The one I'm familar with is PM4DATA (or whatever it's called these days). I offer this as suggestion only, no warrenty is accepted.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Apr 30, 2007 4:08 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Qload support pac for non-mainframe. There are also many samples of code to do this.

For testing purposes use RFHUTILC (support pac IH03), I have used this for messages of 16 MB in size, read from a file.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Mon Apr 30, 2007 4:40 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

I have simple code which sends file content to MQ queue.

It is not very complicated.

Code:
import org.apache.commons.codec.binary.Base64;

...
byte readbytes[] = this.getBytesFromFile(fileName);
      
      
      Base64 base = new Base64();
      byte[] base64value = base.encode(readbytes);
      String base64content= new String( base64value, "UTF-8" );
      this.sendDataViaMQ(queueOut,"<DATA><FILENAME>"+
fileName+"</FILENAME><BASE64CONTENT><![CDATA["+base64content+"]]></BASE64CONTENT></DATA>");

_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Mon Apr 30, 2007 4:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

The complicated part is a large file which has problems during transmission, or needs to be segmented, or similar.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Mon Apr 30, 2007 5:01 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Vitor wrote:
The complicated part is a large file which has problems during transmission, or needs to be segmented, or similar.



Adding segmentation here :

What you have to do:

- divide content into parts in loop
- every part put into MQ with
Code:
mqmessage.messageFlags=MQC.MQMF_SEGMENT;


- last part put into MQ with

Code:
mqmessage.messageFlags=MQC.MQMF_LAST_SEGMENT;



Another thing is reading.

Generally you are absolutely right. It is little more complicated, but if you are motivated to can do it
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Mon Apr 30, 2007 5:11 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

marcin.kasinski wrote:
Generally you are absolutely right. It is little more complicated, but if you are motivated to can do it


If you're well funded you can buy something to do it

It's always possible to reinvent a wheel; nearly always as circular as the originial.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Mon Apr 30, 2007 5:28 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Of cuorse.

We are talking about the same thing.

Somethimes it is better to buy dedicated product which can do it.
Somethimes it is better to implement new version of your applicatin which does it.

It depends on lots of things.

We do both of this.

There was a question about sending file to queue.
I posted only one option.

Maybe garymach64 will consider using it.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Mon Apr 30, 2007 5:39 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

marcin.kasinski wrote:

There was a question about sending file to queue.
I posted only one option.

Maybe garymach64 will consider using it.


And a very good option it was, and worthy of consideration. It all depends on requirements, volume, budget, standards, etc, etc...

If every problem had one and only one answer, the software market would be a lot flatter. And I'd have had to get a proper job years ago.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » General Discussion » putting a file onto a 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.