I'm currently specifying a service-activator and related publish-subscribe channel in an integration-context.xml file. Something like this (abridged version):
<int:publish-subscribe-channel id="notificationChannel" task-executor="executor" />
<int:gateway service-interface="com.integration.gateway.RestClientGateway" default-request-channel="notificationChannel" async-executor="executor"/>
<int:service-activator ref="restClient" method="sendRequest" **order="1"** input-channel="notificationChannel"/>
<int:service-activator ref="actionPersistor" method="persistNotification" **order="2"** input-channel="notificationChannel"/>
Now I need to specify a custom executor class (for MDC logging), so I started playing around with moving this to an annotation based approach. Something along the lines of this :
@Bean
@Description("PubSub channel for notification")
public MessageChannel notificationChannel() {
return new PublishSubscribeChannel(mdcTaskExecutor());
}
@Bean
public TaskExecutor mdcTaskExecutor() {
return MDCThreadPoolTaskExecutor.newWithInheritedMdc(10, 20, 25);
}
@MessagingGateway(name = "restClientGateway", defaultRequestChannel = "notificationChannel", asyncExecutor = "mdcExecutor")
public interface RestClientGateway {
Future<Message<String>> sendRequest(Message<BlEvent> message);
}
@ServiceActivator(inputChannel = "notificationChannel")
public Message<String> sendRequest(Message<BlEvent> message) {
@ServiceActivator(inputChannel="notificationChannel")
public void persistNotification(Message<BlEvent> message) {
My question is, if there's any way to specify the ordering in which the @ServiceActivators receive a message from the pub-sub channel, similar to the way I could define it in the integration-context.xml.
Thanks much for your help. And apologies in advance if this was way too simple as setting a property, coz I couldn't seem to locate it.