4.5. 配置 URI 以写入或读取数据

在以下路由中,Camel 将写入指定的 websocket 连接。

from("direct:start")
        .to("ahc-ws://targethost");

以及对等的 Spring 示例:

<camelContext xmlns="http://camel.apache.org/schema/spring">
  <route>
    <from uri="direct:start"/>
    <to uri="ahc-ws://targethost"/>
  </route>
</camelContext>

在以下路由中,Camel 会从指定的 websocket 连接中读取。

from("ahc-ws://targethost")
        .to("direct:next");

以及对等的 Spring 示例:

<camelContext xmlns="http://camel.apache.org/schema/spring">
  <route>
    <from uri="ahc-ws://targethost"/>
    <to uri="direct:next"/>
  </route>
</camelContext>