I want to create create a custom spring integration DSL to avoid boilerplate code in our product. More concrete, we are creating a lot of flows where we receive data from an AMQP0.9 queue, transform it, and publish it to an Exchange.
From the spring integration docs (https://docs.spring.io/spring-integration/reference/dsl/java-extensions.html) I see it is possible by extending IntegrationFlowExtension
.
So my intention is to create an integration flow that looks something like this:
@Bean
AmqpIntegrationFlow amqpIntegrationFlow() {
return new AmqpIntegrationFlow("someQueue")
.transform(...)
.publishTo("someExchange") // This is the custom method from the extension
.get();
}
The idea is that the constructor contains all the boilerplate code like IntegrationFlow.from(Amqp.inboundAdapter(...))
.
However, there is no way to call from()
from IntegrationFlowExtension
.
How do I handle input ?