XMLからJavaへのSpring統合フローを書き直そうとしています。彼らの可用性に応じて出力チャネルのルーティング
@Bean(name = "sendDataA")
public MessageChannel getSendDataA() {
return MessageChannels.direct()
.get();
}
@Bean(name = "sendDataB")
public MessageChannel getSendDataB() {
return MessageChannels.direct()
.get();
}
:2つの他のチャンネルに
@Bean(name = "sendData")
public MessageChannel getSendData() {
return MessageChannels.direct()
.get();
}
:私はルートチャネルを介して送信されるデータをしたいと思います。
私はどの出力チャネルを使用するかを決定するRoundRobinRouter
クラスを持っています。 route
メソッドの実装は、実際にオブジェクトを使用していないことを
@Component
class RoundRobinRouter {
public String route(Object payload) {
/* implementation */
}
}
注:それは次のように、出力チャンネル名を返すメソッドroute
を持っています。これは、以前のXML構成で配置された:
<int:router method="route" input-channel="sendData"
default-output-channel="sendDataA">
<bean
class="com.example.RoundRobinRouter"/>
</int:router>
私はすでにJavaのDSL IntegrationFlow
を使用して試してみました:
@Bean
@ServiceActivator(inputChannel = "sendData",
outputChannel = "sendDataA")
public IntegrationFlow routeRoundRobin() {
return router -> router.route(roundRobinRouter, "route");
}
しかし、私は明らかに起因する誤差
sendData.send(payload)
コールの「Dispatcherは何の加入者を持っていない」と、なっていました:
org.springframework.expression.spel.SpelEvaluationException: EL1004E:(POS 8):メソッド呼び出し:メソッド設定(com.example.D ataType) は、$ 1018103616分の1 com.example.Integration $$ラムダで見つけることができないタイプ
ルータが私の統合クラスで唯一のラムダです。