Author |
Message
|
kenward |
Posted: Sat Feb 26, 2011 2:39 pm Post subject: logging question |
|
|
 Apprentice
Joined: 01 Jun 2010 Posts: 41 Location: Detroit, MI
|
Using Broker 7 (latest fix packs), I'm trying to drop a message from a flow onto an MQ queue so I can later log the message.
I would like to somehow associate the name of the flow (or really, any string value would be fine) with the message so I know what flow generated the message.
How do I add the value to the message so I can pick up that value in the other flow in a thread safe way? |
|
Back to top |
|
 |
fatherjack |
Posted: Sat Feb 26, 2011 3:50 pm Post subject: Re: logging question |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
kenward wrote: |
I would like to somehow associate the name of the flow (or really, any string value would be fine) with the message so I know what flow generated the message.
How do I add the value to the message so I can pick up that value in the other flow ? |
Add the flow name to the message ?
kenward wrote: |
in a thread safe way? |
Eh? Thread safe or not, the message flow name is the message flow name. _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
n1ghtrain |
Posted: Sun Feb 27, 2011 2:10 am Post subject: |
|
|
 Apprentice
Joined: 23 Mar 2006 Posts: 48 Location: Bangalore
|
You might want to take a look at IA9C Supportpac. It put flowname, threadname and whole lot of other information to the environment variable http://www-01.ibm.com/support/docview.wss?uid=swg24011189
v7.0 is not mentioned as supported. But i didnt had any issues with IA9c in my v7.0 broker (On latest supportpac too).
If you just need to get the flow name and if there is a one-to-one mapping from input queue(or URL) to the flowname then that could be another way. |
|
Back to top |
|
 |
joebuckeye |
Posted: Mon Feb 28, 2011 5:25 am Post subject: |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
|
Back to top |
|
 |
kenward |
Posted: Mon Feb 28, 2011 8:09 am Post subject: |
|
|
 Apprentice
Joined: 01 Jun 2010 Posts: 41 Location: Detroit, MI
|
I'm not worried about where to get the flow name from, but how to send it along with the message.
In flow A, I want to send the message it's working on to flow B to be logged (via an MQ queue). I also want to send along the name of Flow A (which I have covered) so that B knows where the message came from.
I didn't really want to alter the message, but I thought there might be a way to set some meta data about the message so B could read it.
Is the only option to alter the message, as fatherjack mentions? |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Feb 28, 2011 8:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you want to exchange information between two flows, that are communicating using MQ.
And you don't want to change the MQ message.
There are many other ways you can exchange information between flows.
There's nothing that will automatically notify one flow that a message was previously processed by another flow. |
|
Back to top |
|
 |
kenward |
Posted: Mon Feb 28, 2011 8:33 am Post subject: |
|
|
 Apprentice
Joined: 01 Jun 2010 Posts: 41 Location: Detroit, MI
|
Right, I want to exchange information between flows.
Is there a recommended way to do that?
-Jeff |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Feb 28, 2011 8:34 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Alter the MQ message.
Or construct a separate MQ message.
Or insert a record into a database.
Or use monitoring events to log this data, rather than trying to log it in your business logic. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Mar 01, 2011 5:00 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
n1ghtrain wrote: |
You might want to take a look at IA9C Supportpac. It put flowname, threadname and whole lot of other information to the environment variable http://www-01.ibm.com/support/docview.wss?uid=swg24011189
v7.0 is not mentioned as supported. But i didnt had any issues with IA9c in my v7.0 broker (On latest supportpac too).
If you just need to get the flow name and if there is a one-to-one mapping from input queue(or URL) to the flowname then that could be another way. |
You dont need a support pac to do logging. Just use log4j.
http://logging.apache.org/log4j/1.2/ _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Herbert |
Posted: Tue Mar 01, 2011 6:38 am Post subject: Re: logging question |
|
|
 Centurion
Joined: 05 Dec 2006 Posts: 146 Location: Leersum, The Netherlands
|
kenward wrote: |
Using Broker 7 (latest fix packs), I'm trying to drop a message from a flow onto an MQ queue so I can later log the message.
I would like to somehow associate the name of the flow (or really, any string value would be fine) with the message so I know what flow generated the message.
How do I add the value to the message so I can pick up that value in the other flow in a thread safe way? |
IMHO adding a RFH2 header to the message with your meta-data in the user folder is a perfect solution for this.
hgj |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Mar 01, 2011 7:07 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Broker v7 requires MQ v7.
The MQRFH2 is replaced by Message Properties in MQV7.
Even though Broker v7 currently only exposes Message Properties as RFH2 fields... |
|
Back to top |
|
 |
gerdd |
Posted: Mon Mar 07, 2011 4:58 am Post subject: |
|
|
Newbie
Joined: 04 Mar 2011 Posts: 8
|
mqjeff wrote: |
Alter the MQ message.
Or construct a separate MQ message.
Or insert a record into a database.
Or use monitoring events to log this data, rather than trying to log it in your business logic. |
If you hesitate to alter the message body, you may need to look at RFH2 headers for this (beats using a database).
If you like things complicated and you are willing to run all flows in this project in the same exe group you may also be able to devise something around shared variables. But remember you may have many mesasges in the air at the same time  |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Mar 07, 2011 5:19 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
kenward wrote: |
Right, I want to exchange information between flows.
Is there a recommended way to do that?
-Jeff |
We use a Singleton to exchange information between flows of the same EG and to store state information when processing certain time+latency-sensitive request-reply transactions.
To exchange information between flows of different execution groups, we use a variety of methods:
- DB2
- SolidDB
- Shared Memory
- RPC
- MQ
There is also a SupportPac (IA91) but it is buggy and I don't recommend using the SupportPac in production for several reasons: (1) not supported by IBM unless you pay additional fee, (2) you can do the same thing yourself and have the source code to support your production environment, and (3) you will have a clear migration path when you upgrade to latest version (IA91 usually lags behind the latest version support for a while).
Lance _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Esa |
Posted: Mon Mar 07, 2011 5:31 am Post subject: Re: logging question |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
kenward wrote: |
Using Broker 7 (latest fix packs), I'm trying to drop a message from a flow onto an MQ queue so I can later log the message.
I would like to somehow associate the name of the flow (or really, any string value would be fine) with the message so I know what flow generated the message.
How do I add the value to the message so I can pick up that value in the other flow in a thread safe way? |
I would simply make use of MQMD fields ApplIdentityData or ApplOriginData if you are not already using them for something else. MQ and Message Broker are not using these fields for anything. If your flownames are over 32 chars long you will have to truncate them or use some abbreviation to make them fit ApplIdentityData. ApplOriginData is only 4 chars long, could be enough for a broker name abbreviation?
The more natural place would be message properties, but Message Broker does not directly support them yet, as mqjeff pointed out.
If I understood correctly you just wanted to know how to carry the flow name with the message without modifying the payload message? |
|
Back to top |
|
 |
|