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 » File transport with MQSeries

Post new topic  Reply to topic
 File transport with MQSeries « View previous topic :: View next topic » 
Author Message
Fuego Fatuo
PostPosted: Wed Sep 06, 2006 1:08 am    Post subject: File transport with MQSeries Reply with quote

Newbie

Joined: 06 Sep 2006
Posts: 6
Location: Madrid, Spain

Hello,

I need to send and receive files with MQSeries queue. I don't know how do it.
Please, help me!!!

Thanks too much.
Back to top
View user's profile Send private message Send e-mail
HubertKleinmanns
PostPosted: Wed Sep 06, 2006 1:15 am    Post subject: Reply with quote

Shaman

Joined: 24 Feb 2004
Posts: 732
Location: Germany

Do you have MQ version 5 or version 6?

In version 6 there is a FTP over MQ implemented - see the docs for more details.

In version 5 yould write (or buy or find) a program, which reads from file and puts to queue.
_________________
Regards
Hubert
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Wed Sep 06, 2006 1:18 am    Post subject: Reply with quote

Grand High Poobah

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

Do a search in here (button at the top of the page). This subject is one of the perennial favourites.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
HubertKleinmanns
PostPosted: Wed Sep 06, 2006 1:22 am    Post subject: Reply with quote

Shaman

Joined: 24 Feb 2004
Posts: 732
Location: Germany

Addition:

Version 6: System Administration guide, Appendix E

Maybe the q utility (SupportPac MS01) is what you need. This tool is able, to copy (text) files line by line to a (remote) queue. This queue then has to point to another QMgr where a second q program could read the messages and write them back to a file.
_________________
Regards
Hubert
Back to top
View user's profile Send private message Visit poster's website
Fuego Fatuo
PostPosted: Wed Sep 06, 2006 1:24 am    Post subject: Reply with quote

Newbie

Joined: 06 Sep 2006
Posts: 6
Location: Madrid, Spain

Yes, I'm using Websphere MQ version 6
Back to top
View user's profile Send private message Send e-mail
HubertKleinmanns
PostPosted: Wed Sep 06, 2006 1:29 am    Post subject: Reply with quote

Shaman

Joined: 24 Feb 2004
Posts: 732
Location: Germany

Fuego Fatuo wrote:
Yes, I'm using Websphere MQ version 6


Then read the doc or follow Vitor's hint.
_________________
Regards
Hubert
Back to top
View user's profile Send private message Visit poster's website
zpat
PostPosted: Wed Sep 06, 2006 1:43 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Code one program to read a file and send messages, write another to receive messages and write a file. Set the Groupid on messages.
Back to top
View user's profile Send private message
Fuego Fatuo
PostPosted: Wed Sep 06, 2006 1:54 am    Post subject: Reply with quote

Newbie

Joined: 06 Sep 2006
Posts: 6
Location: Madrid, Spain

Thanks very much.
Well, I can send and receive files with File Transfer Application, but now, I ask me how read they with a programme java using jms... Can I use a BytesMessage or exist a easy way to do it?
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Sep 06, 2006 1:56 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

A file is a stream of bytes on disk.

A message is a stream of bytes on a queue.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Sep 06, 2006 1:58 am    Post subject: Reply with quote

Grand High Poobah

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

A message is nothing but a stream of bytes. So go with the suggestion of zpat and code a pair of programmes using whatever methods you find applicable to your needs!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Fuego Fatuo
PostPosted: Wed Sep 06, 2006 2:01 am    Post subject: Reply with quote

Newbie

Joined: 06 Sep 2006
Posts: 6
Location: Madrid, Spain

Yes, but if I have some messages in a queue, how I know that messages them belong to that file? ...
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Sep 06, 2006 2:28 am    Post subject: Reply with quote

Grand High Poobah

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

zpat has already suggested GroupId, but identification of the right message is a design issue. As I said, use whatever method suits you best.

Have you tried a search as I suggested? It may prevent you reinventing a wheel or two.....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Sep 06, 2006 3:43 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

If you want binary file transfer use BytesMessage, if you want to convert string data between platforms use TextMessage (and make sure the messages have format = MQSTR) and use the MQGMO_CONVERT option.

It would help us if you explained the original and destination platforms in more detail. There is also the option of reference messages.
Back to top
View user's profile Send private message
Fuego Fatuo
PostPosted: Wed Sep 06, 2006 5:29 am    Post subject: Reply with quote

Newbie

Joined: 06 Sep 2006
Posts: 6
Location: Madrid, Spain

I have two Java programmes, Sender and receiver, using MQSeries base jms. First, I use File Transfer Application for send a text file (*.txt) at the queue. Now, I want get it, with my programme receiver, but the messages are in MQHRF2 format and I only can use BytesMessage, and then, when I create a file and write the message there, it isn't a text message.

Original File text: Hellow
Final File text:54758693.... [numbers, bytes]

Code:
byte[] replyString = new byte[4194304];//4194304 --> Message Max. size
...
msg = (BytesMessage)qReceiver.receive(10);

if (msg == null) {
System.out.println(" No message received");
} else {
File f = new File("C:/Pepe.txt");
FileWriter fw = new FileWriter(f);
do {
id = msg.getJMSMessageID(); // I want only messages of that same file.
msg.readBytes(replyString);
for(int i=0;i<replyString.length;i++)
fw.write(Byte.toString(replyString[i]));
msg = (BytesMessage)qReceiver.receive(10);
if (msg == null)
continuar = false;
else
continuar = id.equals(msg.getJMSMessageID());
} while (continuar);
fw.close();
}
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Sep 06, 2006 5:49 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Start with two programs that BOTH use TextMessages.
_________________
I am *not* the model of the modern major general.
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 » File transport with MQSeries
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.