Variable Reuse Temptation
When you have a partner link that gets executed multiple times throughout your BPEL process, there is a temptation to invoke that service with the same input and output variables that you used before. While this can work, you should be aware of some of the pitfalls in doing this:
- If you don't explicitly set each input parameter each time you execute the partner link, you will be using a value from the last time that values where copied to the variable.
- If you are executing the same partner link in a parallel branch, do not use the same input and output variables. You WILL have a conflict.
- If you reuse input and output variables, it makes it a little more challenging to determine assignment problem throughout your process.
- One advantage of reusing an input and output variable is that in a large BPEL process reuse produces less assignment clutter. You can generically name the variable and use it throughout your process.
- If your assign is copying namespace info, you can end up having exceptions due to different or unrecognized ns assignments.
So to wrap this up. As a general rule, when you are reusing a partner link. Always create a new set of input and output variables for each invocation. This will spare you a lot of debugging problems down the road.
If you have any additional advantages or disadvantages about variable reuse, please comment.
No comments:
Post a Comment