简体   繁体   中英

Apache Camel: TCP response chunked on first request

I am working on a Camel project to consume a TCP service.

TCP call

<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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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