45.6. Reply 使用请求
SEDA 组件支持使用 Request Reply,其中调用者会等待 Async 路由完成。例如:
from("mina:tcp://0.0.0.0:9876?textline=true&sync=true").to("seda:input");
from("seda:input").to("bean:processInput").to("bean:createResponse");
from("mina:tcp://0.0.0.0:9876?textline=true&sync=true").to("seda:input");
from("seda:input").to("bean:processInput").to("bean:createResponse");
在上面的路由中,我们在端口 9876 上有一个 TCP 侦听器接受传入请求。该请求被路由到 seda:input 队列。由于它是 Request Reply 消息,我们会等待响应。当 seda:input 队列中的使用者完成时,它会将响应复制到原始消息响应。