I migrate project from XML Spring Integration configuration to Java DSL. I prepared some integration tests beforehand. So I can do the migration safely step-by-step.
At some point after moving this XML connector definition
<int:publish-subscribe-channel id="upstreamAckChannel" />
to Java Spring Configuration
@Bean
public PublishSubscribeChannel upstreamAckChannel() {
return MessageChannels.publishSubscribe().get();
}
my integration flow stopped resend test messages to my tests.
After some time and experiments I realized that my Spring Java configuration must have @EnableIntegration
annotation together with usual Spring @Configuration
annotation for properly work.
The question is what is @EnableIntegration
annotation semantic? When I can not use it and when I must use?
I could find only this small Configuration paragraph in official reference manual. Unfortunately, description isn't clear.
Spring Integration provides a wide selection of mechanisms to communicate with external systems. Channel adapters are one such mechanism used for one-way integration (send or receive). And gateways are used for request/reply scenarios (inbound or outbound). Apache Camel is an alternative that is widely used.
The Service Activator is any POJO that defines the @ServiceActivator annotation on a given method. This allows us to execute any method on our POJO when a message is received from an inbound channel, and it allows us to write messages to an outward channel.
PollableChannel interface (such as a QueueChannel ) produces an instance of PollingConsumer . Polling consumers let Spring Integration components actively poll for Messages rather than process messages in an event-driven manner. They represent a critical cross-cutting concern in many messaging scenarios.
The service activator is the endpoint type for connecting any Spring-managed object to an input channel so that it may play the role of a service. If the service produces output, it may also be connected to an output channel.
The PublishSubscribeChannel class exists inside of the Spring Integration project. The @EnableIntegration annotation is used to adopt a default configuration for Spring Integration, so typically when using Spring Integration you'll want to add it (unless you're using a piece of Spring Integration that doesn't require a context--unlikely). The only time you might want to forego it is if you want to do your own configuration from scratch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With