Apache Camel: TCP response chunked on first request

132 views Asked by At

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.

1

There are 1 answers

0
Luca Burgazzoli On

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