简体   繁体   English

Apache Camel:TCP 响应在第一次请求时分块

[英]Apache Camel: TCP response chunked on first request

I am working on a Camel project to consume a TCP service.我正在使用 Camel 项目来使用 TCP 服务。

TCP call TCP调用

<to uri="netty:tcp://0.0.0.0:9001?sync=true&amp;clientMode=true&amp;tcpNoDelay=true&amp;receiveBufferSize=500000&amp;synchronous=true" />

The connection is made successfully, but the first request's response is chunked but I am expecting a full response.连接成功,但第一个请求的响应被分块,但我期待一个完整的响应。 From the next subsequent calls, the response is not chunked and I get the full response.从接下来的后续调用中,响应没有分块,我得到了完整的响应。

Expected response预期回应

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <journal_id>30</journal_id>
    <transaction_id>transaction_deposit</transaction_id>
    <user>Teller01</user>
    <error_code>0</error_code>
    <error_level>0</error_level>
    <error_text />
    <denomination>
        <total>18800</total>
        <currency>USD</currency>
        <coin>0</coin>
        <manual>0</manual>
        <item>
            <value>1000</value>
            <count>1</count>
        </item>
    </denomination>
</response>

Actual response (I get this response only to the first request after the application starts)实际响应(我只对应用程序启动后的第一个请求收到此响应)

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <journal_id>30</journal_id>
    <transaction_id>transaction_deposit</transaction_id>
    <user>Teller01</user>
    <error_code>0</error_code>
    <error_level>0</error_level>
    <error_text />
    <denomination>
        <total>18800</total>
        <currency>USD</currency>
        <coin>0</coin>
        <manual>0</manual>
        <item>
            <value>1000</value>
            <count>1</count>
        </item>

Appreciate if any help can be extended on this.感谢您是否可以对此提供任何帮助。

Thanking you in advance.提前谢谢你。

you need to provide your encoder/decoder as the component does not know how to handle the packets it receive.您需要提供您的编码器/解码器,因为该组件不知道如何处理它收到的数据包。 Please have a look at the example section on the camel-netty component documentation请查看camel-netty 组件文档中的示例部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM