Author |
Message
|
yani03 |
Posted: Mon Apr 03, 2017 10:22 am Post subject: Capture file name with MQGET |
|
|
Newbie
Joined: 03 Apr 2017 Posts: 8
|
Hello all,
New to this forum, so I hope I'm posting in the correct place. I have a visual C++ application that pulls file data using MQGET calls from files loaded on the queue.
I'm hoping there is an option that can be set in one of the parameters to capture the filename in the buffer, that the data is being pulled from? We used to save the buffer data to file based on a substring within the buffer, but this won't be possible anymore with the data provided.
Any advice would be great. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 03, 2017 10:27 am Post subject: Re: Capture file name with MQGET |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
yani03 wrote: |
I have a visual C++ application that pulls file data using MQGET calls from files loaded on the queue. |
You don't load files onto a queue; you put messages on a queue. If the payload of the message was the contents of a file before it was the payload of a message, that's just dandy but is nothing to do with MQ.
yani03 wrote: |
I'm hoping there is an option that can be set in one of the parameters to capture the filename in the buffer, that the data is being pulled from? |
If you mean, "is there an option to record the file name that the payload data used to live in so we get the file name and the payload when we do an MQGET", then yes - set the file name as a message property when you put the message.
If you mean something else, please restate the question. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
yani03 |
Posted: Mon Apr 03, 2017 10:30 am Post subject: |
|
|
Newbie
Joined: 03 Apr 2017 Posts: 8
|
Thanks Vitor, that's exactly what I was asking. Unfortunately I don't have any control over the queue on the other end where the message is being PUT, and it sounds like that is the only way to reserve the name of the file? |
|
Back to top |
|
 |
yani03 |
Posted: Mon Apr 03, 2017 10:32 am Post subject: |
|
|
Newbie
Joined: 03 Apr 2017 Posts: 8
|
yani03 wrote: |
Thanks Vitor, that's exactly what I was asking. Unfortunately I don't have any control over the queue on the other end where the message is being PUT, and it sounds like that is the only way to reserve the name of the file? |
To clarify, the messages are PUT to the queue by a third party, and that queue is hosted by a 2nd party, both independent of me. |
|
Back to top |
|
 |
yani03 |
Posted: Mon Apr 03, 2017 10:46 am Post subject: Re: Capture file name with MQGET |
|
|
Newbie
Joined: 03 Apr 2017 Posts: 8
|
Vitor wrote: |
yani03 wrote: |
I have a visual C++ application that pulls file data using MQGET calls from files loaded on the queue. |
You don't load files onto a queue; you put messages on a queue. If the payload of the message was the contents of a file before it was the payload of a message, that's just dandy but is nothing to do with MQ.
yani03 wrote: |
I'm hoping there is an option that can be set in one of the parameters to capture the filename in the buffer, that the data is being pulled from? |
If you mean, "is there an option to record the file name that the payload data used to live in so we get the file name and the payload when we do an MQGET", then yes - set the file name as a message property when you put the message.
If you mean something else, please restate the question. |
If I can get the filename set as a message property, do I need to set any certain parameter option in the MQGET call, or will it come across in the message itself? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Apr 03, 2017 10:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You may need to set the gmo option PROPERTIES_IN_HANDLE and enumerate the properties until you find the right one? ...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 03, 2017 11:01 am Post subject: Re: Capture file name with MQGET |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
yani03 wrote: |
If I can get the filename set as a message property, do I need to set any certain parameter option in the MQGET call, or will it come across in the message itself? |
It's a message property not part of the message. You need to correctly specify the MsgHandle in the MQGMO structure as described here. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
yani03 |
Posted: Mon Apr 03, 2017 12:50 pm Post subject: |
|
|
Newbie
Joined: 03 Apr 2017 Posts: 8
|
Thank you both for your help. Any idea what the earliest version of MQ the GQMO_PROPERTIES_IN_HANDLE option was available? I'm on Version 6.0.0.0 and I don't see this option in my cmqc.h header file. |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Apr 03, 2017 3:37 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
A simple search on google for 'MQ message properties' would have answered this question.
http://www.redbooks.ibm.com/redbooks/pdfs/sg247583.pdf _________________ 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 |
|
 |
gbaddeley |
Posted: Mon Apr 03, 2017 3:56 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
yani03 wrote: |
Thank you both for your help. Any idea what the earliest version of MQ the GQMO_PROPERTIES_IN_HANDLE option was available? I'm on Version 6.0.0.0 and I don't see this option in my cmqc.h header file. |
The base Version 6? I find that remarkable. Even though this is many years out of support, I would have expected an upgrade would have occurred to 6.0.2 + a recent FixPack level.
MQ messages don't have any concept of "file name". It is up to the producer app and consumer app to agree on a requirement for passing a file name, whether its in the message data, a message property, or a user-settable MQMD field (will have very limited length). _________________ Glenn |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 04, 2017 4:41 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What's a 'file'?
Is this something that sits on a personal workstation and holds non-business critical data in a relatively unsecured environment that doesn't need to move between separate applications? _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 04, 2017 5:17 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
yani03 wrote: |
Thank you both for your help. Any idea what the earliest version of MQ the GQMO_PROPERTIES_IN_HANDLE option was available? |
MQv7. You'll need to use an RFH2.
yani03 wrote: |
I'm on Version 6.0.0.0 and I don't see this option in my cmqc.h header file. |
Do you have any idea how out of date (and out of support) that is? More importantly, do you have any idea how much risk your organization is carrying that the next OS / firmware / other upgrade will cause it to fail? Has anyone in your organization signed off on that risk? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
yani03 |
Posted: Tue Apr 04, 2017 5:24 am Post subject: |
|
|
Newbie
Joined: 03 Apr 2017 Posts: 8
|
mqjeff wrote: |
What's a 'file'?
Is this something that sits on a personal workstation and holds non-business critical data in a relatively unsecured environment that doesn't need to move between separate applications? |
Sorry I said 'file' I'm not that familiar with MQ. It's built into a C++ windows application that I did not write, but am now maintaining. The messages are being transported across the country.
I'm trying to figure out how to capture the filename that the messages are originating from. It sounds like I need to update versions and create a message handle to collect the properties of the message. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 04, 2017 5:33 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
yani03 wrote: |
It sounds like I need to update versions and create a message handle to collect the properties of the message. |
You need to update the version for far more reasons than collecting the file name (which you can do with an RFH2, the predecessor of the message properties). My most worthy associate has very particular views on files, which while correct, do not fit into the more pragmatic world the rest of us are forced to endure.
But 6.0.0.0 is hideously out of date. Someone needs to sign off on that risk before it blows up in your face, or a very urgent update project needs to be started. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Apr 04, 2017 8:50 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Are you saying that the source data originates in a file in a filesystem, and that an upstream app reads the file and converts the source data to MQ messages? Or, are you saying that an upstream app creates a message with the data component is a file?
Why do you need to know the name of the source file? _________________ 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 |
|
 |
|