Spring Integration Management Bus Configuration via Annotations
Simple question: Is there a way to customize Spring Integration Management Bus via annotations (without any xml)
<control-bus input-channel="operationChannel"/>
?
source to share
@Bean
@ServiceActivator(inputChannel = "controlBusChannel")
public ExpressionControlBusFactoryBean controlBus() throws Exception {
ExpressionControlBusFactoryBean controlBus = new ExpressionControlBusFactoryBean();
return controlBus;
}
Note that anything outputChannel
in the annotation will be ignored; it is defined on the bus itself.
Typically, the control bus output channel is omitted with the result of normal request / response operations, for example @someBean.isRunning()
(if someBean implements Lifecycle
, for example), reverting to a header replyChannel
(for example, to MessagingTemplate.sendAndReceive()
or a messaging gateway).
If you need to send the control bus control results to a different location, add an output pipe to the factory bean.
Any MessageHandler
@Bean
(or factory bean that creates one) can now be annotated with @ServiceActivator
. See the documentation .
source to share
Spring Integration Java DSL provides material on this subject:
@Bean
public IntegrationFlow controlBusFlow() {
return IntegrationFlows.from("operationChannel").controlBus().get();
}
source to share