Apache camel ApacheCamel-从netty到文件
我正在使用netty组件进行两个系统(请求和请求)之间的套接字通信 答复 这是路线Apache camel ApacheCamel-从netty到文件,apache-camel,netty,Apache Camel,Netty,我正在使用netty组件进行两个系统(请求和请求)之间的套接字通信 答复 这是路线 <from uri="netty:tcp://localhost:61616?encoder=#encoder"/> <to uri="netty:tcp://localhost:61618?decoder=#decoder"/> <log message="Receive ${body}"> <to uri="file://data?fileName=data2&
<from uri="netty:tcp://localhost:61616?encoder=#encoder"/>
<to uri="netty:tcp://localhost:61618?decoder=#decoder"/>
<log message="Receive ${body}">
<to uri="file://data?fileName=data2&charset=utf-8"/>
一切正常,我发送的数据是缓冲区类型,以及收到的响应。我可以使用日志${body}将此数据视为字符串,但文件中不支持存储此数据
我猜camel使用一个转换器(从缓冲区到字符串)将正文记录为纯文本,但是为什么不在文件中保存一些内容,使用默认的转换器呢
对于如何解决这一问题,我表示感谢。谢谢你 由于paylaod是ByteBuffer,因此需要显式转换为字符串或字节[]
<from uri="netty:tcp://localhost:61616?encoder=#encoder"/>
<to uri="netty:tcp://localhost:61618?decoder=#decoder"/>
<convertBodyTo type="byte[]"/>
<log message="Receive ${body}">
<to uri="file://data?fileName=data2&charset=utf-8"/>
您甚至可以使用type=“java.lang.String”
请参考链接
希望对您有所帮助……谢谢。我用得很紧,当然不行:P。