Just a simple question: Is there any way to configure Spring Integration Control Bus via annotations (without any xml)
@Bean
@ServiceActivator(inputChannel = "controlBusChannel")
public ExpressionControlBusFactoryBean controlBus() throws Exception {
ExpressionControlBusFactoryBean controlBus = new ExpressionControlBusFactoryBean();
return controlBus;
}
Note that any outputChannel on the annotation will be ignored; it is defined on the bus itself.
Typically the output channel of a control bus is omitted with the result of normal request/reply operations, such as @someBean.isRunning() (if someBean implements Lifecycle for example) going back to the replyChannel header (e.g. to a MessagingTemplate.sendAndReceive() operation or a Messaging Gateway).
If you need to send the control bus operation results some place else, add an output channel to the factory bean.
Any MessageHandler @Bean (or a factory bean that creates one) can now be annotated with @ServiceActivator. See the documentation.
The Spring Integration Java DSL provides the stuff on the matter:
@Bean
public IntegrationFlow controlBusFlow() {
return IntegrationFlows.from("operationChannel").controlBus().get();
}