When you add a @ServiceActivator annotation on a method, that method can have different return types which seem to have different implications for the service:
@ServiceActivator(inputChannel = "..", outputChannel = "..")
public T messageReceiver() {...}
Where T could be
voidObject MessageHandlerHow does the ServiceActivator differ based on the return type? I am specifically wondering about the line in the docs that says:
Return values from the annotated method may be of any type. If the return value is not a Message, a reply Message will be created with that object as its payload.
But I'm not following this because I've seen people return MessageHandlers from their ServiceActivator-annotated methods, and they don't want their MessageHandlers to be wrapped as a payload right?
Like this:
@Bean
@ServiceActivator(inputChannel = "sendAsyncChannel", autoStartup="false")
public MessageHandler sendAsyncHandler() {
return // some MessageHandler
}
What you are pointing is a Messaging Annotations on @Bean. This is a bit different story and it implies not related to POJO method invocation aspect.
We use that @ServiceActivator on the MessageHandler @Bean to register an EventDrivenConsumer endpoint for the provided MessageHandler, when the POJO method style, creates a MethodInvokingMessageHandler for the marked with this @ServiceActivator method.
Please, see more info in the Reference Manual:
https://docs.spring.io/spring-integration/docs/5.0.9.RELEASE/reference/html/overview.html#programming-tips and:
https://docs.spring.io/spring-integration/docs/5.0.9.RELEASE/reference/html/configuration.html#annotations_on_beans
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