Patterns

Singleton Orchestration
As you know In BizTalk Orchestrations, a new instance of an Orchestration is created every time a message arrives at the Receive Port. So what will be the number of orchestrations if we developed an orchestration responsible to login the user ? WOW. for each user want to login, there will be an instance of orchestration .

In your orchestration you have two receive shapes, one to activate the orchestration, and the other inside an infinite loop (or you can put some condition on the loop so you can exit he orchestration on will, which is a good idea) that correlates to the receive port Name as in figure


Advantages of a Singleton pattern:
  • Singleton pattern can be implemented interfaces.
  • It can be also inherit from other classes.
  • It can be lazy loaded.
  • It has Static Initialization.
  • It can be extended into a factory pattern.
  • It help to It hide dependencies.
  • It provides a single point if access to a particular instance, so it is easy to maintain.

Disadvantages of a Singleton Pattern
  • Unit testing is more difficult (because it introduces a global state into an application).
  • This pattern reduces the potential for parallelism within a program, because to access the singleton in a multi-threaded system, an object must be serialized (by locking).

No comments:

Post a Comment