Discussion on Messaging pattern
Context:
Some distributed systems are composed of services that were developed independently. To form a coherent system, however, these services must interact reliably, without incurring overly tight dependencies on one another.
Problem
Integrating independently developed services, each having its own business logic and values, into a coherent application requires reliable connection between services. However, since services are developed independently, they are generally unaware of each other's specific functional interfaces. Furthermore, each service may participate in multiple integration contexts, so using them in specific context should not preclude their use in other contexts.
Solution
connecting these services via message bus allow them to transfer data messages asynchronously. Encode the message (request data and data types) so that senders and receivers can communicate reliably without having to know all the data type information statically.
Benefit
- Service can interact without having to deal with networking and service location concerns.
- Asynchronous messages allows services to handle multiple requests simultaneously without blocking.
- Allow service to participate in multiple application integration and usage contexts.
Liability
- Lack of statically typed interfaces makes it hard to validate system behaviour prior to runtime.
- Service requests are encapsulated within self-describing messages that require extra time and space for message processing.
Discussion on Publisher-Subscriber pattern
Context
Components in some distributed application are loosely coupled and operate largely independently. If such application needs to propogate information to some or all theirs components, a notification mechanism is needed to inform the components about the state changes or event that affect or coordinate their own computation.
Problem
The notification system should not couple applications too tightly or they will loose their independence. Components want to know only that other component is in specific state, not which specific component is involved. Components that disseminate events often do not care which component want to receive the information. Components should not depend on how other components can be reached or on their specific location in the system.
Solution
Define a change propagation infrastructure that allow publisher in a distributed application to disseminate events that may be interest to others. Notify subscriber events in those events whenever such events is published.
Benefit
- Publisher can asynchronously transmit events to subscribers without blocking.
- Asynchronous communication decouples Publisher from Subscribers, allowing them to be active and available at different times.
- Publisher and Subscriber are unaware of each other's location and identity.
Liability
- Publisher can cause unnecessary overhead if subscribers are interested in only a specific type of events.
- Filtering events to decrease event publishing and notification overhead can result in other costs (eg: decrease in throughput, unnecessary notifications, breakdown of anonymous communication model).
Discussion on Dynamic Routing pattern
Context
It is often complex to build complex business processes by wiring together a set of relatively simple services in a dynamic way.
Problem
Routing messages through a distributed system based on filtering rules is inefficient because messages are sent to every destination's filter and router for inspection and rules resolution, whether or not messages could be processed.
Solution
Define a message router that includes both filtering rules and knowledge about the processing destination paths so that messages are delivered only to processing endpoints that can act on them. Unlike filters, message router do not modify the message content and are concerned only with message destination.
Benefit
- Services do not need to deal with networking concerns or know each other's location since all requests are handled through message router.
- Communication can be optimised as services dynamically became available or unavailable.
- Efficient or predicate routing.
Liability
- Performance overhead.
- Single point of failure.
- Potentially complex, unintuitive behaviour when rules conflict.



