Spring Integration Interview Questions list in 2020

This article is targeted towards providing a comprehensive list of Spring Integration inteview questions, which are typical to be asked in an interview.

Like Spring Security, interviewers generally doesn’t ask questions on Spring Integration but if your resume mentions it, then knowledge on this becomes mandatory.

So, Spring Integration Interview Questions could be important for an interviewer(so for you), given a job profile. Questions and answers mentioned here are good enough for both freshers and experience candidates.

So, without any further delay, let’s deep dive in the questions and answers.

Spring Integration Interview Questions and Answers

1. What is Spring Integration? Please introduce it.

Spring Integration is a Spring project to support Enterprise Integration Patterns, with it’s proven lightweight, non-intrusive and decoupled programming model.

It does so:

  1. By helping build subsystems with simple POJOs in a decoupled manner, which, later on, could be assembled very easily.
  2. Enables a lightweight messaging system with-in Spring based applications.
  3. Provides a wide variety of channel adapters and gateways to talk to external systems.

Spring Cloud Stream project is built on top of Spring Integration.

2. What is “Pipes and Filters” architecture in Spring Integration?

In any message driven asynchronous system, communication is done through and by three things:

  1. Messages to communicate between different sub-systems.
  2. A transport to deliver the messages.
  3. Sub-systems themselves which are either producing or consuming the messages.

In this, transport is represented as Pipes and message producer/consumer subsystems are represented as Filters.

3. Could you name some of the main components of Spring Integration?

Note: This is one of the most favorite of Spring Integration Interview Questions.

After this, a rhythm starts on the questions and answers. So, FOCUS.

Now the Answer:

Yes, Sure. There are three fundamental components of Spring integration. Any kind of integration flow is possible by using these three components and their different types.

  1. First, we have Message.
  2. Then, Message Channel
  3. And, Message EndPoint

All the patterns and solutions revolves around these only.

4. What is a Message in Spring Integration?

A message is a wrapper object which consists of:

  1. Headers
  2. And Payload

Headers, is set of key-value pairs which holds meta-information like timestamp, file name, message ID etc, of the message.

These headers certainly helps framework in routing the message in the system, in a desired manner.

Timestamp and MessageID are mandatory headers. We can add any number of headers to pass on information in our messaging flow.

On the other hand, Payload could be any type of object which might hold the real data.

5. What is a Message Channel?

A message channel represents Pipe in Pipes and Filters architecture.

It decouples Message Producers and Message Consumers.

While Producers send messages to it, Consumers receive messages from it.

Message Endpoints are generally connected to one or more Message Channels. In this way, different message endpoints works as Producer/Consumer.

6. What is a Message EndPoint then?

While Message Channel represents Pipes in Pipes and Filters architecture, a Message EndPoint represents Filter in it.

It’s job is to abstract the communication of a business domain component with the messaging infrastructure.

In other words:

to connect our business component with messaging infrastructure without the noise.

With this, we do not need to:

  • create messages.
  • implement producers or consumers directly.
  • Invoke message channel’s send or receive API.

All this is handled by Message EndPoints.

and we have varieties of these message endpoints for different kinds of needs.

We just need to plug our business domain component with the desired infrastructure, in a declarative manner. A non-invasive way.

7. What are different types of Message EndPoints?

We have:

  1. Message Transformer
  2. Message Filter
  3. Message Router
  4. Splitter
  5. Aggregator
  6. Service Activator
  7. Channel Adapter

8. What is a Message transformer in Spring integration?

It is a Spring Integration component which does the following:

  1. Add, remove or modify Message Headers.
  2. Convert Message payload from one format to another. For example: XML to CSV , XML to JSON etc.

Basically, it transform a message from one form into another.

9. What is a Message filter?

Note: This is different from the Filter concept of Pipes and Filter architecture.

A message filter is a special kind of endpoint which decides if a message will go to the output channel or not.

Decision is made on Boolean value returned from a custom method with custom logic provided by us.

We can return the response depending on custom conditions like:

  • If a file with particular extension exists or not.
  • If payload exists or not.
  • If payload is of any particular type or not etc.

If method returns false for a message then either the message will be dropped or an exception will be raised depending upon how we have configured it.

10. What is a Message Router?

Message Router decides the next channel where the message will be received.

Spring Integration provides us different kinds of in-built routers.

For example:

  1. Payload type router: It routes the incoming messages coming from incoming channel to different output channels, depending upon payload type.
  2. Header Value router: It decides the output channel depending upon one of the header value.
  3. Recipient list router: It sends the incoming messages to all the configured output channels, a kind of static broadcasting.

Explain the different filters. It will make your position string in the interview. Mark it as easy but one of the important Spring integration interview questions.

11. What is a Splitter?

A Splitter receives a Message, splits it into multiple messages and then sends them to their appropriate channels.

It is done in cases of composite Payloads wherein a composite Payload is split into multiple simple targeted Payloads.

12. What is an Aggregator?

In functional prospect, an Aggregator works totally opposite to a Splitter.

An Aggregator combines multiple Messages into a Single Message.

13. What is Service Activator?

Service Activator is a Message EndPoint which

  • connects with Input Channel
  • receives the Message
  • invokes the service object

The Service object then further process the Message.

14. What is a Channel Adapter?

It’s a type of endpoint which connects a Message Channel to some other system or transport.

15. How many types of Channel Adapters are there?

It is of two types:

  1. Outbound Adapters
  2. Inbound Adapters

OutBound Adapters is used to connect with systems to which our channel sends the Messages.

Inbound Adapters is used to connect with the system from which our channel receives the Messages.

Reference Material

Spring Integration Docs

What to read next?

Go through Spring Security Interview Questions, if part of your resume.

Have a look at Spring Boot Interview Questions if not done already.

Or, Checkout our series on Spring Interview Questions and choose the interview topic which is suitable for the job interview you are trying to crack.

Best of luck!!

Leave a Comment