Search code examples
javaspring-bootspring-integrationspring-integration-dsl

How To Build An Integration Flow For Different Types Of Integrations


I know that the spring DSL can be a very powerful tool but, how do you know how to build one from scratch depending on your different needs? When I see an integration flow online it's easy to follow and I can generally make sense of the flow. However, when building something a little bit more custom how do you know what goes into the integration flow? Im new to spring integration and the Spring DSL in general so it would be useful to know where is a good place to start and what is the best way of thinking about things when it comes to spring integration.


Solution

  • I treat this question as a fundamental matter familiarity. Consider to start from Enterprise Integration Patterns, learn what is Message, Endpoint and Channel. Then you re-think the logic of your application as some service calls, which could be initiated by messages sent to endpoints for those service activator. When it is all good for you, you start combining the logic into a flow, when an output channel of one endpoint becomes as an input for the next one. Essentially this is exactly what is going on underneath with the mentioned IntegtionFlow abstraction. Then you go further and determine for your self that several flow could be connected via the same not one time already mentioned channels. It is not quick one stop shop, but it is fun to rethink the logic of your application as messaging exchange.

    See more info in docs: https://docs.spring.io/spring-integration/docs/current/reference/html/messaging-endpoints.html#messaging-endpoints-chapter.

    The Java DSL with its IntegationFlow definition is just a higher level of abstraction on top of endpoint implementations for specific EI patterns.