在 Spring XML 文件中,我们将端点配置为在端口 10514 上侦听 udp 信息,请注意,在 netty 中,我们将禁用默认的Codec,允许一个回退到 NettyTypeConverter,并将消息作为 InputStream 传递:
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<syslog id="mySyslog"/>
</dataFormats>
<route>
<from uri="netty:udp://localhost:10514?sync=false&allowDefaultCodec=false"/>
<unmarshal ref="mySyslog"/>
<to uri="mock:stop1"/>
</route>
</camelContext>
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<syslog id="mySyslog"/>
</dataFormats>
<route>
<from uri="netty:udp://localhost:10514?sync=false&allowDefaultCodec=false"/>
<unmarshal ref="mySyslog"/>
<to uri="mock:stop1"/>
</route>
</camelContext>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<syslog id="mySyslog"/>
</dataFormats>
<route>
<from uri="mina:udp://localhost:10514"/>
<unmarshal ref="mySyslog"/>
<to uri="mock:stop1"/>
</route>
</camelContext>
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<syslog id="mySyslog"/>
</dataFormats>
<route>
<from uri="mina:udp://localhost:10514"/>
<unmarshal ref="mySyslog"/>
<to uri="mock:stop1"/>
</route>
</camelContext>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow