0
我試圖設計一個消息處理管道,需要使用多個端點處理消息。在每個階段,端點都會返回有效負載(可能會被轉換)或錯誤消息。下面是我在我的腦海一般示例:彈簧集成 - 處理流水線 - 設計
<int:payload-type-router input-channel="preprocessing-output">
<int:mapping type="com.example.Error" channel="error" />
<int:mapping type="com.example.PreprocessedDomainObject" channel="validation-input"/>
</int:payload-type-router>
<int:service-activator input-channel="validation-input"
ref="validationService" method="validate" output-channel="validation-output"/>
<int:payload-type-router input-channel="validation-output">
<int:mapping type="com.example.Error" channel="error" />
<int:mapping type="com.example.CouldBeAnotherObject" channel="processor-input"/>
</int:payload-type-router>
等等,這個處理鏈可能會很長...有沒有更好的方式來設計這個,而不是每一個階段之後的有效載荷類型的路由器?有點覺得多餘。