Spring Integration-2 :Adapters
Adapters are messaging endpoints. In particular, they are the message endpoint that bridges your Spring Integration system to external systems and services (like JMS queues, databases, mail systems, etc.).
Adapters (aka Channel adapters)
An endpoint which connects channel to external systems
- It provides the bridge b/w Intregation framwork and external systems and services
- provides saperation of messaging concerns from transports and protocol used
Adapters are Inbound and Outbound
Inbound- Those that brings messages into Spring Integration Channels
Outbound- Those that gets messages from SI channels to outside Applications , Databases etc.
Built in Adapters
- Stream Adapters(like standard input and output stream adapters)
- File Adapters
- JMS Adapters
- JDBC and JPA Adapters
- FTP and Secure FTP( SFTP) Adapters
- Feed (RSS,Atom etc) Adapters
- Mail Adapters
- MongoDB Adapters
- UDP Adapters
- Twitter Adapters
We can create custom adapter as per application requirements.
Example Adapters:
A JMS Inbound Adapter
- Take message from Message Queue and gets it to SI Channel.
- Need JMS connection factory and queue configurations
- JMS channel adapters are part of SI’s JMS Module (int-jms namespace)
- Note that JMS pulls the messages at the poll rate
<jms:inbound-channel-adapter id="jmsIn" connection-factory="jmsConnectionFactory" destination="inQueue" channel="exampleChannel"> <integration:poller> <integration:interval-trigger interval="30" time-unit="SECONDS"/> </integration:poller> </jms:inbound-channel-adapter>
A JMS Outbound Adapter
- Take message from a Message Channel and deliver it to Message Queue (via JMS)
- Also need JMS Queue
<jms:outbound-channel-adapter id="jmsOut" destination="outQueue" channel="exampleChannel"/>