enterprise integration patterns cs3300 fall 2015
TRANSCRIPT
Enterprise Integration Patterns
CS3300Fall 2015
Problem
● Modern systems in large enterprises are distributed across many platforms and comprised of many systems.
● How do we get them to operate together?
Categories● Information Portal : You have to access more
than one system to answer a particular status. The portal allows access to a single interface, that hides all the other systems.
● Data Replication : Sometimes the same data is stored across multiple systems (sales, accounting, billing). If the data changes, it needs to change everywhere.
● Shared Business Function : Same functionality is needed by multiple systems.
Categories● Service Oriented Architecture: Universal
services available to consumers● Distributed Business Processes: A single
transaction may span several systems.● Business to Business Integration: Providing
access outside the company (ie. Shipping company allowing customers to interact with their system for obtaining delivery dates)
Goal● Loose Coupling – reduce the amount of
assumptions one system has to make about another.
Simple Patterns (for communication)
● File Transfer : Have applications produce and consume files to read and write information
● Shared Database: Have applications store data in a common database
● Remote Method Invocation: Use an rpc mechanism (RMI, CORBA, COM, SOAP)
● Messaging : Asynchronous communication with custom formats
Messaging Components● Channels : virtual pipe connecting the sender and
receiver● Messages : atomic packet of data transmitted on
a channel● Pipes and Filters : chaining processing of
messages using channels● Routing : controlling the flow of messages that
have to go through many channels● Transformations : Converting information
between systems● Endpoints : a bridge between the message
system and the application
A Practical Implementation JMS
8
JNDI - Java Naming and Directory Interface
9
• Mapping human-readable names to machine names• Like DNS for web sites• Binding links names to objects (a filename to the physical file)• Context is a set of bindings. ( a file directory for example)• Name Service manages these contexts.
Different Architectures
10
JMS Programming Model
11
CQRS-ES● Command Query and Response Segregation● Event Sourcing
Traditional System Design
CQRS
Row 1 Row 2 Row 3 Row 40
2.5
5
7.5
10
12.5
Column 1 Column 2
Column 3
Why CQRS?● May perform 1000s of reads for each write,
thus each part can be optimized separately for transaction throughput. Each part can be scaled independently
● Commands are complex, Reads are simple. Each part can be optimized and maintained separately
● Can use two versions of the database, fully normalized for writes, consolidated for reads
● However it is not an architectural style, but a lower level concept
Concepts● Bounded Context : An autonomous business
component with clear boundaries – a self-contained business model
● Orders and Registrations● Conference Management● Payments● Submissions and Schedule Management
● Context Map : Showing the relationships between the bounded contexts
More Concepts● Command – request for the system to perform
and action MakeSeatReservation● Commands are transported on a command bus to
command handlers● Commands originate in either the UI or the Process
Manager
● Event – Something that has happened in the system, often in response to a command OrderConfirmed
● Multiple subscribers may handle an event
More components● ProcessManager – controls domain model
● Subscribes to events and creates commands● No business logic, just logic to figure out what
command to send
Event Sourcing● Events:
● Happened in the past● Are immutable● May cancel or negate a previous event● Are one way messages● Usually have parameters for additional information● Should describe a business intent
Event Sourcing● ES then is a way of persisting your
application's state by storing the history that determines the current state of the application.
Traditional ORM
Event Sourcing
Data Transfer Objects● These solutions frequently use DTO.● An object is created, forwarded to the UI. The
UI makes changes and the object is returned to the model for processing
● In CQRS, a DTO is sent to the UI, but the UI issues a command