Home Page › Forums › BizTalk 2004 – BizTalk 2010 › using decision shape with orchestration variables
- This topic has 3 replies, 1 voice, and was last updated 7 years, 8 months ago by community-content.
-
AuthorPosts
-
-
October 20, 2008 at 6:01 PM #21021
Hey Gurus,
Got another question. I have an orchestration that will be checking the value of my orchestration variable: Token. I’m using a decision shape to see if Token is empty: System.String.IsNullOrEmpty(Token);. If Token is empty, the orchestration should get Token from a local database (i’m using a custom class and calling from expression shape) and then write it to the orchestration variable: Token.
The orchestration works great as far as hitting the database is concerned. When i submit my test message to the orchestration, it hits that shape all three times (the number of messages in my envelope). But i only want to hit the database one time at initialization and then skip that step because now Token would NOT be null or empty.
I’m guessing that the decide shape is processing all those messages at once when in fact i want the message to complete (and update Token) before the next one is submited? I’m also guessing that a scope shape would be used to accomplish this?
If there is anyone out there who could help me, I would really appreciate it.
Thank you,
Bart
-
October 21, 2008 at 8:20 AM #21025
Are you using a loop in your orchestration to iterate over the messages, or are you splitting the messages in the pipeline and processing each message with a new instance of the orchesration? If you are using separate orchestration instances, then you are getting new instances of the variables, so the token will be null. In that case you might want to look at using a helper class with a static variable to hold the token.
-
October 21, 2008 at 9:01 AM #21026
Thank you Rusel, I didn’t realize a new instance of the orchestration would be created for each message. I should be able to adjust my class to handle that pretty easily.
In a best practices sense, would it be better to break the message in the pipeline (which i’m doing now) or loop through the messages in the orchestration and use the orchestration variables?
Thank you,
-
October 21, 2008 at 1:51 PM #21029
Separate orchestration instances is a more scalable approach since the instances can be distributed across multiple servers. I would probably go that route.
Also, in your class, I would probably use a caching pattern with periodic refresh rather than a pure static variable.
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.