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

  1. It provides the bridge b/w Intregation framwork and external systems and services
  2. 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

  1. Stream Adapters(like standard input and output stream adapters)
  2. File Adapters
  3. JMS Adapters
  4. JDBC and JPA Adapters
  5. FTP and Secure FTP( SFTP) Adapters
  6. Feed (RSS,Atom etc) Adapters
  7. Mail Adapters
  8. MongoDB Adapters
  9. UDP Adapters
  10. 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"/>

Popular posts from this blog

Window function in PySpark with Joins example using 2 Dataframes (inner join)

Complex SQL: fetch the users who logged in consecutively 3 or more times (lead perfect example)

Credit Card Data Analysis using PySpark (how to use auto broadcast join after disabling it)