2017-04-13 7 views
2

現在、サービスアクチベータおよび関連するpublish-subscribeチャネルをintegration-context.xmlファイルに指定しています。この(要約版)のようなもの:Spring統合(javaConfigを使用)のパブリッシュ/サブスクライブチャネルでServiceActivatorの順序を指定する

<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"/> 

は、今私は(MDCロギング用)カスタムエグゼキュータのクラスを指定する必要があるので、私は、アノテーションベースのアプローチには、この移動で遊んで始めました。この線に沿って何か:

@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) { 

@ServiceActivatorsはパブのサブチャネルからメッセージを受信する順序を指定するにはどのような方法があるかどう私の質問は、私はそれを定義することができます方法と同様に、であり、 integration-context.xmlを参照してください。

ご協力いただきありがとうございます。そして、もしこれがプロパティを設定するのは簡単すぎるならば、私はそれを見つけることができなかった。

答えて

0

はい、メッセージの注釈と一緒に@Orderを追加するだけです。

リファレンスマニュアルでの抜粋には言及していないと思います。

この問題に関しては、JIRAチケットを無料でお持ちください!

+0

ありがとうございましたArtem!それはうまくいった! – sj0509

関連する問題