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 » WebSphere Message Broker (ACE) Support » store variables to LocalEnvironment using mapping node

Post new topic  Reply to topic
 store variables to LocalEnvironment using mapping node « View previous topic :: View next topic » 
Author Message
hdjur
PostPosted: Wed Feb 07, 2007 1:00 am    Post subject: store variables to LocalEnvironment using mapping node Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

Talking about LocalEnvironment tree structure:

Quote:

Variables
This subtree is optional. If you create local environment variables, you are recommended to
store them in a subtree called Variables. It provides a work area that you can use to pass
information between nodes. This subtree is never inspected or modified by any supplied node.
Variables in the local environment can be changed by any subsequent message processing node...


I would like to store MQMD.MsgId to this tree using mapping node. Is it possible?
I have changed Mapping mode to LocalEnvironment And Message, using Add or Remove Headers and Folders... dialogue box in target pane I have chosen LocalEnvironment (and in source pane I have chosen MQMD), but the only LocalEnvironment subtree I see is Destination (MQ,HTTP,RouterList). Can I use some of these, or do I have to use compute nodes instead? I would like to access this variable the same way in a subsequent mapping node. Thank you.
Back to top
View user's profile Send private message
hdjur
PostPosted: Wed Feb 07, 2007 9:34 am    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

Forget about the mapping node. I have a problem with a scope of LocalEnvironment variables. I have compute node immediately after MQInput node, it stores MsgId to LocalEnvironment properly with:
Code:
SET OutputLocalEnvironment.Variables.MsgId  = InputRoot.MQMD.MsgId;


Before MQOutput node, I have another compute node, which tries to access it with:
Code:

SET OutputRoot.MQMD.CorrelId     = InputLocalEnvironment.Variables.MsgId;

Both compute nodes have compute mode set to LocalEnvironment and Message. Trace node which precedes second compute node shows correctly preserved LocalEnvironment variable until that point:

local env: (
(0x01000000):Variables = (
(0x03000000):MsgId = X'414d51205742524b5f544553545f514d458974692006820b'
)
(0x01000000):LOCAL_STACK = (
. . .

Trace node which follows second compute node shows that CorrelId was not properly set:

(0x01000000):MQMD = (
(0x03000000):StrucId = 'MD '
(0x03000000):Version = 2
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 819
(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'
(0x03000000):Format = ''
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = 0
(0x03000000):PutDate = DATE '2007-02-07'
(0x03000000):PutTime = GMTTIME '17:03:55.212683'
(0x03000000):Expiry = -1
(0x03000000):Priority = 0
)

and that LocalEnvironment is lost.
Quote:

Variables in the local environment can be changed by any subsequent message processing node, and persist until the message flow goes out of scope and the node that created it has completed its work and returns control to the previous node.

I don't understand that. Variable persists throughout the flow, but when I try to access it, it disappears. Thanks in advance.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Feb 07, 2007 9:54 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You have to not only set the compute mode, you have to copy InputLocalEnvironment to OutputLocalEnvironment.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
hdjur
PostPosted: Thu Feb 08, 2007 1:12 am    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

You are right about preserving LocalEnvironment after the second compute node, which I shouldn't probably mention at all.
Any comments on posted ESQL? Because I still have null CorrelId.

(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'

The reason I'm doing this, is because I remove MQMD header before issuing HTTP request, and when I restore it, to return response to a queue I have to set CorrelId to the MsgId of the request. Is there a better practice to do it besides using LocalEnvironment? I have read some suggestions to copy data to an intermediate queue.
Back to top
View user's profile Send private message
hdjur
PostPosted: Thu Feb 08, 2007 1:59 am    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

Quote:
but the only LocalEnvironment subtree I see is Destination (MQ,HTTP,RouterList). Can I use some of these, or do I have to use compute nodes instead?

According to data type xsd:hexBinary, none of them might be suitable?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Feb 08, 2007 4:19 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Have you tried using the Environment tree instead of LocalEnvironment?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
hdjur
PostPosted: Thu Feb 08, 2007 8:22 am    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

I just did, didn't solve the problem. I have replaced in the first compute node:

Code:
      SET Environment.Variables.MsgId  = InputRoot.MQMD.MsgId;
--      SET OutputLocalEnvironment.Variables.MsgId  = InputRoot.MQMD.MsgId;

and in the second
Code:
      SET OutputRoot.MQMD.CorrelId     = Environment.Variables.MsgId;
--      SET OutputRoot.MQMD.CorrelId     = InputLocalEnvironment.Variables.MsgId;

set on both nodes compute mode="All".
The only difference I see is that Environment persists after the second compute node without being explicitly copied from input to output in that node.
Back to top
View user's profile Send private message
hdjur
PostPosted: Thu Feb 08, 2007 9:10 am    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

I have tried also in the second compute node (I don't know why, I just did):
Code:
      SET OutputRoot.MQMD.CorrelId     = CAST(Environment.Variables.MsgId AS BLOB);

Useless.
Back to top
View user's profile Send private message
hdjur
PostPosted: Thu Feb 08, 2007 9:31 am    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

Do I have to emphasize somehow that InputRoot.MQMD.MsgId is of REFERENCE data type before storing it to Environment? Or while accessing it from Environment? Any example please?
Back to top
View user's profile Send private message
hdjur
PostPosted: Thu Feb 22, 2007 7:20 am    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

I have solved my problem of correlating response (output) mq message and request (input) mq message in the same flow, by changing Advanced Properties of HTTP Request node, so that input mq message (especially important is its MQMD) is passed on together with http response, on the output of HTTP Request node. So that I am able now to map in the mapping node source MQMD to target MQMD (MsgId to CorrelId). I have eliminated the need for compute node, since the only reason for introducing it was to restore MQMD, which was lost with previous HTTP Request node settings. The interesting part here is the secret link between MQMD.CorrelId element and Properties.ReplyIdentifier element. Namely, the reason why the posted esql didn't work was because I have mapped Properties.ReplyIdentifier, setting it this way to null in a mapping node, and I couldn't fix it in subsequent compute node (set MQMD.CorrelId), although MsgId value was stored correctly in Environment.Variables. Anyone, please feel free to add any comment.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Feb 22, 2007 1:36 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Depending on how you create the correlation id...

If created in preceding MQOutput node you need to get it from
Code:
set OutputRoot.MQMD.correlid = InputLocalEnvironment.WrittenDestination.MQ.DestinationData.correlId;

as this is where the output value of the node gets written AND NOT to the message's MQMD.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
hdjur
PostPosted: Thu Feb 22, 2007 2:52 pm    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

I'm sorry for not explaining clearly what does the flow look like. I have MQInput node, Mapping node#1, HTTP Request node, Mapping node#2, and MQOutput node. The flow works as a web service client. Web service call is issued via http. Request arrives as mq message, gets transformed to http request, and http response gets transformed to response mq message. MQOutput node is not preceding to any other node in this flow. Does that change anything, or the suggestion still stands?
Thanks.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Feb 22, 2007 8:32 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

No but you need to preserve the input message or at least the MQMD for the MQReply node.

Best way is to create the adequate parser in the Environment and park it there until you need it again....

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
hdjur
PostPosted: Thu Feb 22, 2007 11:55 pm    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

I have preserved input message by using Advanced Properties settings of HTTP Request node, that is :
"Replace input message with web-service response"
and
"Response message location in tree"

From input MQMD I have used not only MsgId for correlation purposes,
but also for example Persistence and Expiry, and every other attribute which makes sense to be the same or similar to request message attributes. Is there anything wrong with this logic?
Back to top
View user's profile Send private message
hdjur
PostPosted: Fri Feb 23, 2007 1:00 am    Post subject: Reply with quote

Centurion

Joined: 16 Sep 2004
Posts: 116
Location: Zagreb

When I said:
Quote:
and I couldn't fix it in subsequent compute node (set MQMD.CorrelId), although MsgId value was stored correctly in Environment.Variables

I meant until I didn't remove Properties mapping, so that it works now this way too (using compute node). But I still wonder why this was a neccessary step?
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 » WebSphere Message Broker (ACE) Support » store variables to LocalEnvironment using mapping node
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.