Skip to content

Instantly share code, notes, and snippets.

@pmihalcin
Created June 5, 2018 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmihalcin/1b374d1292f0ba85e249b5e9389ee242 to your computer and use it in GitHub Desktop.
Save pmihalcin/1b374d1292f0ba85e249b5e9389ee242 to your computer and use it in GitHub Desktop.
spring-integration
three first class citizens in Spring Integration
Message, Channel and Endpoint
Message - an independent, immutable container of data to transfer throughout business logic
Channel - we have to decouple business logic and be able to distribute the last one when it is requested
Channel has two ends: producer and consumer(s)
But at the same time there are many different channel implementation
and depending on that we determine what type of Endpoint (consumer) to declare
See ConsumerEndpointFactoryBean for more details
The target endpoint will consume messages from the channel it is subscribed and will handle them
And at this point on scene appears a MessageHandler abstraction
This part is already fine-grained according target protocol specifics or just because there are those EIPs.
That's why we have a ServiceActivatingHandler, AbstractMessageSplitter, AbstractCorrelatingMessageHandler etc.
Since the contract of the endpoint <-> handler doesn't require from us to be specific, it is fully fine to provide any custom MessageHandler implementation for handling message from the channel.
More over it is even better at runtime, because we don't do any reflections to invoke the method, but just call your handleMessage() implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment