341.4. RFC5424 Syslog 协议

可从 Camel 2.14 开始

要公开 Syslog 侦听器服务,我们重复使用现有的 camel-mina 组件或 camel-netty ,其中我们仅使用 SyslogDataFormat 进行汇总和解封消息

341.4.1. 公开 Syslog 侦听程序

在 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&amp;allowDefaultCodec=false"/>
          <unmarshal ref="mySyslog"/>
          <to uri="mock:stop1"/>
    </route>

</camelContext>

使用 camel-mina的相同路由

<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>