Author |
Message
|
reddy_kal |
Posted: Mon Nov 04, 2002 2:20 pm Post subject: How to transfer messages from Queues into the local system |
|
|
Acolyte
Joined: 04 Nov 2002 Posts: 73
|
Hi,
I am getting XML files into my queue. I need to transfer that files into my disk. Can anyone help me in this.
Thanks in advance |
|
Back to top |
|
 |
Lisa |
Posted: Mon Nov 04, 2002 3:22 pm Post subject: Unload queue |
|
|
Master
Joined: 07 Jun 2002 Posts: 287 Location: NJ
|
|
Back to top |
|
 |
wmqiguy |
Posted: Tue Nov 05, 2002 5:34 am Post subject: |
|
|
 Centurion
Joined: 09 Oct 2002 Posts: 145 Location: Florida
|
Another one to consider is the Q utility. Nice little command line utility that can be used on UNIX as well as NT and OS2 platforms.
It is also a support pac (MA01). See link above from Lisa.
Good to have choices.
Todd |
|
Back to top |
|
 |
Yanghui |
Posted: Wed Nov 06, 2002 4:46 am Post subject: |
|
|
Disciple
Joined: 08 May 2002 Posts: 151 Location: Dublin, Ireland
|
I tried q program. It's not too bad but I found it's impossible to dump a queue with all message to a file. Is this right?
By the way, where can I get PQ editor? Is it free? Thanks a lot.
Regards
-Yanghui
P.S. I am also looking for a tool which can find MQ objects connections. For example, if I want to delete a queue and it's opened by other applications. How can I find which applications are still holding the connections. |
|
Back to top |
|
 |
wmqiguy |
Posted: Wed Nov 06, 2002 5:50 am Post subject: |
|
|
 Centurion
Joined: 09 Oct 2002 Posts: 145 Location: Florida
|
Since the queue utility is command line, you can just redirect the output to a file (destructively or non-destructively using -b):
q -iQUEUE -mQMGR > myfile.txt
If you want to add some automation, then write a script with the above and have the queue triggered. I won't go into scripting here, but you can create individual files for each message and name with a TIMESTAMP or you can redirect with an append so that they all go to the same file:
q -iQUEUE -mQMGR >> myfile.txt
Have fun....
Todd |
|
Back to top |
|
 |
Yanghui |
Posted: Wed Nov 06, 2002 6:27 am Post subject: |
|
|
Disciple
Joined: 08 May 2002 Posts: 151 Location: Dublin, Ireland
|
Todd,
Thanks a lot. It's very helpful.
Actually I am thinking a better way of doing logging of msgflows. Now I have a copy queue of both input and output queue of one message flow. Then all the message coming in and going out of message flow are backuped on the two copy queues. The two copy queues are great for analysis what msgflow is doing. But the price is to have extra mq admin work sinc the queue depth of the two copy queues increase rapidly. It's not nice to move all the messages to somewhere else manually. It's better to achieve the two queue daily.
It seems q program almost can help to get there. There is only one thing I don't know how to do it. What I want is to dump all messages on a queue within one day to a file, one day one file with date as part of file name. Is this possible? Sorry I am not familiar with scripts. Do you mind to provide some sample scripts to do this? Many thanks.
Looking forward to your response.
Regards
-Yanghui |
|
Back to top |
|
 |
wmqiguy |
Posted: Wed Nov 06, 2002 6:41 am Post subject: |
|
|
 Centurion
Joined: 09 Oct 2002 Posts: 145 Location: Florida
|
Use whatever you have to schedule Cron, etc. to run this script once/twice/three (whatever your requirement) times a day:
q -i QUEUENAME >> YOURFILENAME.`date +%Y%m%d%H%M%S`
This is a UNIX flavor (flavour for my English friends).
Todd |
|
Back to top |
|
 |
Yanghui |
Posted: Wed Nov 06, 2002 7:26 am Post subject: |
|
|
Disciple
Joined: 08 May 2002 Posts: 151 Location: Dublin, Ireland
|
Todd,
Thanks a lot again.
Clearly it's very doable.
I am going to run a cron job once a day against those queues which need to dump all messages to a file. The script will be something like:
cat /dev/null >MYQUEUENAME.txt
q -i MYQUEUENAME -dd3 >>MYQUEUENAME.txt
cp MYQUEUENAME.txt "MYQUEUEUNAME.txt`date +%d%m%y`"
It's always safer to have logging for msgflow.
Kind regards to my American friends
-Yanghui
P.S. In Ireland, majority are Irish not English.  |
|
Back to top |
|
 |
reddy_kal |
Posted: Wed Nov 06, 2002 2:18 pm Post subject: |
|
|
Acolyte
Joined: 04 Nov 2002 Posts: 73
|
Thanks Lisa and Todd,
Its very helpful |
|
Back to top |
|
 |
kp |
Posted: Thu Nov 07, 2002 2:17 am Post subject: Using Q (ma01) for data migration between 2 qmgrs. |
|
|
Novice
Joined: 16 Oct 2002 Posts: 15 Location: Belgium
|
Hi,
After reading this topic, I wanted to use Q to migrate data between 2 queue managers on AIX systems. As far as I understand the list of options it should be possible to dump all messages in a file, and then reload the file, sending it to another qmgr.
So:
q -i KP -m MQ1 -b > file
q -o KP -m MQ2 -f file.
Messages are XML's and binary messages.
Though the load of an XML ends up in several messages as \n is used as delimiter and loading a binary file (like q) results in 2000 messages in my queue.
Do I use the wrong options or is Q not intended for that use (binaries and multiline text messages) ?
Thanks in advance for any help you can provide to migrate my data.
KP |
|
Back to top |
|
 |
wmqiguy |
Posted: Thu Nov 07, 2002 5:47 am Post subject: |
|
|
 Centurion
Joined: 09 Oct 2002 Posts: 145 Location: Florida
|
If migrating between Qmgrs, I would use the following:
Create a remote queue (SENDTOQM2.KP) on QM1 that points to the second QMGR and then use q to send them directly without having to use the file (you will maintain the MQMD this way too):
q -m QM1 -iKP -oSENDTOQM2.KP -b
This should make a copy of all messages and send them to QM2.
Just an idea.....have fun.
Todd |
|
Back to top |
|
 |
Yanghui |
Posted: Thu Nov 07, 2002 6:42 am Post subject: |
|
|
Disciple
Joined: 08 May 2002 Posts: 151 Location: Dublin, Ireland
|
Hi, Todd,
It's really a good idea.
Do you know if q program supports client connection on NT&W2K? I found there are two executables, q and qc, for all UNIX platform. I assume that qc is for MQ client as amqsputc or amqsgetc. I am wondering why there is no qc on NT&W2K.
Thanks in advance.
-Yanghui |
|
Back to top |
|
 |
wmqiguy |
Posted: Thu Nov 07, 2002 7:35 am Post subject: |
|
|
 Centurion
Joined: 09 Oct 2002 Posts: 145 Location: Florida
|
Okay, I don't have the answer. Anyone else?
You can always submit a question throught the Support Pack site, but they don't guarantee answers.
Good Luck
Todd |
|
Back to top |
|
 |
kp |
Posted: Fri Nov 08, 2002 12:33 am Post subject: |
|
|
Novice
Joined: 16 Oct 2002 Posts: 15 Location: Belgium
|
Thanks Todd, That's indeed a great idea to solve the migration.
But if anyone is aware of a tool that can upload bin files or text files with newlines, I'd be glad to know; just curiosity as I ll go for Todd's option for the migration. |
|
Back to top |
|
 |
kp |
Posted: Fri Nov 08, 2002 12:37 am Post subject: |
|
|
Novice
Joined: 16 Oct 2002 Posts: 15 Location: Belgium
|
As far as Yanghui's question is concerned: here is an extract of the readme that comes with q.zip (sometimes it does help to read a readme file )
On the Unix platforms two programs are supplied Q and QC. Q is a locally bound application which connects directly to the Queue Manager. QC is the client version of the program. On OS/2 and Windows NT a single program, Q, is supplied. The mode of operation for this program is controlled via the '-l' parameter given below.
and
-l<Library> [ OS/2 and Windows NT only]
The MQI library to link to, valid values are:
mqm - Queue Manager program
mqic32 - Client program
If not specified the program will try to use the Queue Manager
interface. If that is not present it will try to use the
MQClient interface.
Cheers,
KP |
|
Back to top |
|
 |
|