cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing data between different instances of the same mapping

Former Member
0 Kudos

The problem is that I need to share somehow data between different instances of the same mapping. Lets say that I need to include to the target field the number of mappings done so far, so I need to store the counter somewhere, so it will be avilable to the further mappings.

The GlobalContainer variables works only for the current mapping instance or for the whole mapping at all?

Another problem is that the mapping is JAVA-mapping, so I am not sure if I can use Global Variables from Java Sections.

Thanks for any solutions!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Any reason you cant just use an integration process? Then just use container operations to increment a counter. Would then give you additional control over how the counter is initialised if you want too.

Cheers

James.

Former Member
0 Kudos

Hello J, thanks a lot for your reply!

So you are saying, that if I will define a variable in BPM, and than will increment it in cantainer, than it (variable) will be the same for all instances of BPM. If, for example, two messages have came in very short period of time, and two instances of BPM processing those messages in parallel they will share the only one variable?

Or if, for example, I have one message yesterday, have increneted counter to one, and one message today, are you sure that the varibale will keep the value from yesterday?

Sound some kind of unrealistic to me. I will make some tests.

Thanks again for your reply!

Former Member
0 Kudos

Not quite.

You launch a BPM once, then use a receiver step within a loop to keep receiving, mapping then sending messages (you can use correlations to tie specific messages to specific BPM instances).

The variable you define will only be applicable to the current instance of the BPM, therefor if you launch multiple BPM's or the instance dies etc, it will be re-initialised. This might not be what you want, hence I only offer it for suggestion as an alternative

I've used this approach with a timeout branch to receive messages for x period of time then fire them off as a batch.

Hope that helps

prabhu_s2
Active Contributor
0 Kudos

if u had used global container in one mapping program u cannot refer or retrieve the value in another mapping program. yes it can been refrenced betwwen different instance of the same mapping program.

In java program why do u want to use global program when the variable declared in a java program can be made public to all the methods

Former Member
0 Kudos

Hello Prabhu, thanks a lt for your response!

But I have just made some test with GlobalContainer object, I have set some variable, but during the next mapping progarm run it was not accesible. Do you know what can be the problem?

prabhu_s2
Active Contributor
0 Kudos

say u have create 2 mapping program, the global container for mapping program A cannot be accessed in mapping program B but the container can be accessed at various instances(node levels) in mapping program A itself. if u need some data accessible across all mapping program then u need to make use of lookups where u can store the data in a DB table and later retrieve it in UDF and map accordingly. This way you address for global access

Message was edited by:

Prabhu S

Former Member
0 Kudos

I have only one mapping program. A first message comes, than the mapping program is called for the first time, and I set inside it some variable. When a second message comes the mapping program is called for the second time, and the variable which was setted in the first mapping program run is no longer exist in GlobalContainer object. This is the problem.

Can you please tell a little bit more about "lookups where u can store the data in a DB table". What is this?

Message was edited by:

Artsiom Anichenka

prabhu_s2
Active Contributor
0 Kudos

okie when the second message comes it teh container will again be intialized and the reference to the earlier value will be lost. "lookups where u can store the data in a DB table" - look for DB look up or rfc lookup

prabhu_s2
Active Contributor
0 Kudos

DB lookup : /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

RFC Lookup: /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer

Message was edited by:

Prabhu S