Neuron ESB User Network

The Service Bus for the Connected Business

Hi everybody,
I couldn't find any documentation regarding parallel process step.
It seems like that context.Properties values are not persisted after the parallel steps, is that corrrect?

context.State instead works. Is there any drawbacks with it, or something I should pay attention to?

What's the difference between using context.Properties and context.State collections?

Thank you!
Fabrizio

Tags: parallel, process, properties

Views: 336

Reply to This

Replies to This Discussion

Hi Fabrizio. Each branch of the parallel process step receives its own copy of the context.Properties collection, and you are right that those values are not persisted after the parallel step. This was done so that we did not have to worry about or complicate the implementation with concurrency issues typical with sharing data across threads. The side-effect of this is that at the end of the branch execution, there's not really a good way of merging changes to context.Properties because two or more branches may have conflicts that prevent merging.

context.State is global data that is tied to the process itself, not to any particular process instance. It is backed by a ConcurrentDictionary, so it can be safely accessed by multiple threads. All executions of a process share the same context.State object.

I hope that this helps. Please let me know if you have any additional questions.

great, thanks for the explanation.

Then I understand it's not a good strategy to use context.State.. I could end up with wrong data being shared my multiple instances.
What would be a way to save values retrieved within a branch? Do we have a kind of instance id to use as key to a collection saved in the context.State?

Any other suggestions?

Thank you
F.

Actually, I need to correct my previous answer. I was just looking at the source code. At the end of the branch execution, we do merge the context.Properties for the branch into the main process branch. What we do is that we add the property in the format "<branch-name>.<property-name>". So if you create a property in context.Properties named "accountId" in a branch named "Branch1", then you can retrieve it later using the key "Branch1.accountId".

We only merge the properties that either do not exist in the main context.Properties for the process, or whose values differ from what's in context.Properties.

Yes! it works,
thank you for the quick answer and explanation

RSS

Neuron ESB Product Support Forums and Communities

Latest Activity

Anupama Nair posted a discussion

Marketo Adapter Invalid Token

Hi,We are using the Marketo adapter to push account updates to Marketo. It works well for some time then starts failing with Invalid Token unless restarted. Is there a configuration that can be done so it can auto refresh the token when required?Thanks!See More
Nov 6, 2023
Sayantini Basak posted a discussion

Maximum payload size(REST API) for requests interfacing to NeuronESB

I am new to Neuron ESB and in our current scenario,We need to process batch transactions comprising of ~1000 records and send them to Neuron ESB for further processing. I would like to understand what is the maximum size of payload that can be transferred using REST interface to Neuron ESB.See More
Jul 22, 2022
Profile IconRobert E Dunie and Sayantini Basak joined Neuron ESB User Network
Apr 28, 2022
Profile IconDayanand, Frederic C, Steffen Greve-Oksfeldt and 1 more joined Neuron ESB User Network
Mar 16, 2022
Profile IconCam Vong and Mitja Luznar joined Neuron ESB User Network
Jan 27, 2022
Profile IconWill Hitzges, Chad Parsons, michael larsen and 4 more joined Neuron ESB User Network
Jun 11, 2021
Anupama Nair posted a discussion

ODBC stored proc polling with temporary tables

We have set up an ODBC adapter to poll a stored proc.We found that if the stored proc has a temporary table defined the rows returned are always 0.Any idea why this would be and what we can do to get around it?See More
Dec 14, 2020
Prasanth Kharade is now a member of Neuron ESB User Network
Dec 30, 2019

Badge

Loading…

© 2024   Created by Neuron Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service