Author |
Message
|
arunkumar1989 |
Posted: Thu Aug 29, 2013 2:01 am Post subject: How to share variable/message between the flows |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
Hi all,
First Flow
======
MQInput -> compute( a=10; a=a+100;)->MQOutput
Second Flow
========
MQInput -> Compute(a=110)-> MQOutput
This is an sample flows only... the main moto is i want to share or access a variable between flows. _________________ Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd.
Last edited by arunkumar1989 on Thu Aug 29, 2013 2:08 am; edited 1 time in total |
|
Back to top |
|
 |
iShakir |
Posted: Thu Aug 29, 2013 2:06 am Post subject: Re: How to share variable/message between the flows |
|
|
Apprentice
Joined: 07 Mar 2013 Posts: 47
|
arunkumar1989 wrote: |
Hi all,
First Flow
======
MQInput -> compute( a=10; a=a+100;)->MQOutput
Second Flow
========
MQInput -> Compute(a=?)-> MQOutput
This is an sample flows only... the main moto is i want to share or access a variable between flows. |
You have a few options depending on your scenario - I suggest taking a look at the Coordinated Request Response product sample, as it deals with a couple of options for storing static message data between flows.
In a nutshell you have ESQL shared variables, MQ Queues, and the Global Cache as your primary options. I suggest looking into all three to find the best solution to your problem.
EDIT: Or a database, but I guess that's not what you're looking for... |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Thu Aug 29, 2013 8:02 pm Post subject: |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
Thanks iShakir,
I have tried with Shared variable.... but its not accessible in to another flow.
is there any other option to do this. _________________ Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd. |
|
Back to top |
|
 |
Simbu |
Posted: Thu Aug 29, 2013 8:15 pm Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
arunkumar1989 wrote: |
Thanks iShakir,
I have tried with Shared variable.... but its not accessible in to another flow.
is there any other option to do this. |
Please use Google Search "share variable between two flows in message broker"... you will get the answers. |
|
Back to top |
|
 |
JenniferBroodman |
Posted: Thu Aug 29, 2013 8:42 pm Post subject: |
|
|
Newbie
Joined: 29 Aug 2013 Posts: 2
|
I have tried it..But unable to find the prominent answers over it..Is there any other alternatives? So that I will fix it out..Find some Google drive security options.. |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Thu Aug 29, 2013 10:41 pm Post subject: |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
Thanks Simbu,
I searched into google i got few ideas... i came up with following code,
First flow Compute Node Code
Code: |
DECLARE intValue SHARED INTEGER 1;
CREATE COMPUTE MODULE SharedVarFlow1_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
CALL CopyEntireMessage();
BEGIN ATOMIC
SET intValue=intValue+1;
END;
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
|
Second flow Compute Node Code
Code: |
SET OutputRoot.XMLNSC.MyXML.value=intValue;
|
After 3 times executed to first flow the the inValue has 3.
if i run second flow that should be 3 but it showing initial value 1.
*I have deployed into same execution group only.
can any one say .. i missed any steps.[/code] _________________ Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd. |
|
Back to top |
|
 |
Simbu |
Posted: Thu Aug 29, 2013 11:01 pm Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
arunkumar1989 wrote: |
After 3 times executed to first flow the the inValue has 3.
if i run second flow that should be 3 but it showing initial value 1.
*I have deployed into same execution group only.
can any one say .. i missed any steps.[/code] |
shared variables are limited to flow level. Please read http://www.mqseries.net/phpBB2/viewtopic.php?t=47723. you will get some more idea. |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Thu Aug 29, 2013 11:13 pm Post subject: |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
Simbu,
I read that whole thread. yes i feel some what clear.
I am going to conculde this.
* Shared variables are eg wide. but we cannot access the updated value by other flows. only we get initial value.
Apart from db ,queue,shared... can we share var/msg to other flows. _________________ Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd. |
|
Back to top |
|
 |
iShakir |
Posted: Fri Aug 30, 2013 12:34 am Post subject: |
|
|
Apprentice
Joined: 07 Mar 2013 Posts: 47
|
arunkumar1989 wrote: |
Simbu,
I read that whole thread. yes i feel some what clear.
I am going to conculde this.
* Shared variables are eg wide. but we cannot access the updated value by other flows. only we get initial value.
Apart from db ,queue,shared... can we share var/msg to other flows. |
Yes that's fine, Shared variables perhaps aren't the solution to your problem. If you're on WMB v8.0.0.1 or IIB v9 then the Global Cache is your best caching solution (by this stage it seems like you do want caching). It's pretty easy to get going with, the documentation is all in the Infocenter. |
|
Back to top |
|
 |
|