Understanding Message in Spring Integration

Thanh Tran
Dec 26, 2020 · 3 min read

In this article, we will learn about message term in Spring Integration

Image for post
Image for post
Photo by Anne Nygård on Unsplash

In order to loose coupling between components in a system, we typically apply the messaging system to achieve that aim. That requires a solid understanding of what is a message and some type of message for effective use for specific scenarios. So in this article, I would like to share the definition of the message, the structure of a message, and common types of messages in a messaging system.

What is a message in a messaging system?

As the spring integration reference document defined that “In Spring Integration, a message is a generic wrapper for any Java object combined with metadata used by the framework while handling that object. It consists of a payload and headers

Image for post
Image for post
figure: message, source:https://docs.spring.io/spring-integration/reference/html/overview.html#overview-components-message

The message header provides the metadata of the message provided by the sender and might be used during the transfer, or for routing the message.

Another part of a message is the message payload, it provides the actual content of the message the sender wants to send and it can be of any type, such as structured text or binary data,...

Message in Spring Integration is similar to mail, we have to provide the required information for the mail to be sent such as the name of the sender, the name of receiver, postal code, or how it might return in case the message can not be sent.

To illustrate, see how the Spring team abstracts the Message

org.springframework.messaging.Message
org.springframework.messaging.Message

Common types of message in the messaging system

Based on the message intent, the message is categorized into three types:

  • Command Message

The command message used when an application needs to invoke functionality provided by other applications.

Image for post
Image for post

The document message used when an application would like to transfer data to another application.

Image for post
Image for post

And the scenario for the last message type is event-notification.

Image for post
Image for post

Conclusion

By now, we have learned about the message in the messaging system and have introduced some types of messages based on message intent. I would like to provide you some great resources that might help you deep-dive into the messaging system.

References

Affiliated Amazon Book Link: Enterprise Integration Patterns

Give me motivation

To get new article update please follow our publication or follow us on social

Facebook: https://www.facebook.com/programmingsharing

Twitter: http://twitter.com/progsharing

Programming Sharing

We write about programming. We share about programming.

Sign up for Programming Sharings Newsletter

By Programming Sharing

Get new articles update by signing up our newsletter Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Thanh Tran

Written by

Software Engineer at Terralogic. Blogger and Amateur Investor

Programming Sharing

The publication to share programming knowledge

Thanh Tran

Written by

Software Engineer at Terralogic. Blogger and Amateur Investor

Programming Sharing

The publication to share programming knowledge

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store