Author |
Message
|
Fuego Fatuo |
Posted: Wed Sep 06, 2006 1:08 am Post subject: File transport with MQSeries |
|
|
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 |
|
 |
HubertKleinmanns |
Posted: Wed Sep 06, 2006 1:15 am Post subject: |
|
|
 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 |
|
 |
Vitor |
Posted: Wed Sep 06, 2006 1:18 am Post subject: |
|
|
 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 |
|
 |
HubertKleinmanns |
Posted: Wed Sep 06, 2006 1:22 am Post subject: |
|
|
 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 |
|
 |
Fuego Fatuo |
Posted: Wed Sep 06, 2006 1:24 am Post subject: |
|
|
Newbie
Joined: 06 Sep 2006 Posts: 6 Location: Madrid, Spain
|
Yes, I'm using Websphere MQ version 6 |
|
Back to top |
|
 |
HubertKleinmanns |
Posted: Wed Sep 06, 2006 1:29 am Post subject: |
|
|
 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 |
|
 |
zpat |
Posted: Wed Sep 06, 2006 1:43 am Post subject: |
|
|
 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 |
|
 |
Fuego Fatuo |
Posted: Wed Sep 06, 2006 1:54 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Wed Sep 06, 2006 1:56 am Post subject: |
|
|
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 |
|
 |
Vitor |
Posted: Wed Sep 06, 2006 1:58 am Post subject: |
|
|
 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 |
|
 |
Fuego Fatuo |
Posted: Wed Sep 06, 2006 2:01 am Post subject: |
|
|
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 |
|
 |
Vitor |
Posted: Wed Sep 06, 2006 2:28 am Post subject: |
|
|
 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 |
|
 |
zpat |
Posted: Wed Sep 06, 2006 3:43 am Post subject: |
|
|
 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 |
|
 |
Fuego Fatuo |
Posted: Wed Sep 06, 2006 5:29 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Wed Sep 06, 2006 5:49 am Post subject: |
|
|
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 |
|
 |
|