We are living in a connected word, where unrestricted sharing of data becomes an ultimate goal.
This reflects the architecture of the software systems where the main focus is on building enterprise integrated solutions.
Enterprise Integration Patterns (EIP) are used to architecture and design integrated solutions.
During the past decades following integration styles have been identified:
- file transfer
- shared DB
- RMI
- messaging
Asynchronous messaging is the most used architectural style for enterprise integration. It allows building of the loosely coupled solutions which overcomes limitations of the remote communication.
This talk is about messaging, and the way Spring supports EIP via Spring Integration project.
2. INTEGRATION
• Creating a single, monolite app to cover
all aspects of business is hard
• Enterpises are comprised of
applications which can be: custom
build, 3rd party, legacy
• Connecting computer systems,
companies or people
• Share data and processes
3. INTEGRATION CHALLENGES
• Networks: unreliable & slow
• Differences: language, platform & data format
• Changes
• Limited control
• Standards
• Maintenance
4. INTEGRATION STYLES
• File transfer
• Shared DB
• RMI
• Messaging
• asyncronous
• reliable transfer
• common format (messages)
• Loose coupling
5. MESSAGE AND CHANNEL
• Message
• Header – information about the data
• Payload (body) – the data being transmitted
• Channel
Header
Payload
Header
Payload
• Point-to-Point
• Publish-Subscribe
Header
Payload
Header
Payload
Header
Payload
Producer Consumer
6. PIPES AND FILTERS
Persist
Pipe
Create validation
email
Pipe Pipe
Filter Filter
Send validation
email
SMTP
Pipe
Filter
USER
Registration
• Divide complex processing
• Filters – independent processing steps
• Pipes – connect filters into a sequence
• Fundamental architectural style for messaging
• Pipe = Channel
• Filter = Endpoint
7. SPRING INTEGRATION
• Top-level project in spring.io
• Enables lightweight messaging
• Combines DI, POJO and Messaging
• Implements most of EIP
• Includes wide selection of channel adapters
• SI != MOM, ESB
8. EXAMPLE: USER REGISTRATION
• After user registration validate email address by sending
confirmation link to email and notify moderators about new
profile
• In steps:
• Generate confirmation link (UUID)
• Store userId -> UUID
• Send confirmation email
• Notify site moderators about the new profile
SMTP
ADMIN
REST API
Information Portal
Data Replication
Shared Business Function
SOA
Distributed Business Process
B2B Integration
Data transport over network compared to the same on one computer requires taking into account much more things which can go wrong. This is because networks are generally unreliable and slow, which requires more complex implementations of data transport in order to achieve reliability not compromising performance.
Changes: unavoidable
Limited control: 3rd party or legacy
Standards: XML – no semantics
Maintenance: operation and maintenance (infrastructure automation)
File: formats, frequency, transfer, sync issues (sharing data)
DB: SQL RBDMS (standard) + ORM, schema issues (and relational model is not suitable for all use cases – NoSQL + NO encapsulation) (sharing data)
RMI: encapsulation (Java RMI, WS SOAP), performance (local vs remote calls) (sharing functions)
Messaging:
Loose coupling: sender no longer has to depend on receiver internal data format (messages) nor its location (channels) or readiness (asynchronous + queuing)
Message – data encapsulation
Channel – decouples message producers from consumers
Point-to-Point: only one receiver will consume particular message; channel CAN have multiple consumers
Publish-Subscribe: broadcast any message to all subscribers
Inbound Channel Adapter: connect an application to the messaging system so that it can send and receive messages (Spring application events in this case)
Direct Channel: point to point semantics
Message: payload = RegistrationEvent
Content Enricher: appends data to the message – headers and/or payload (use expression to generate UUID and add to the message header)
Wire Tap: publishes each incoming message to the main channel and a secondary channel (per channel or global)
Inbound Channel Adapter: connect an application to the messaging system so that it can send and receive messages (Spring application events in this case)
Content Enricher: appends data to the message – headers and/or payload (use expression to generate UUID and add to the message header)
Wire Tap: publishes each incoming message to the main channel and a secondary channel (per channel or global)
Composite processor: splits the message up, routes the sub messages to appropriate destinations and aggregates responses (harder because of the asynchronous nature).
Composite processor: splits the message up, routes the sub messages to appropriate destinations and aggregates responses (harder because of the asynchronous nature).
Composite processor: splits the message up, routes the sub messages to appropriate destinations and aggregates responses (harder because of the asynchronous nature).
Composite processor: splits the message up, routes the sub messages to appropriate destinations and aggregates responses (harder because of the asynchronous nature).