Jeroen de Beer
Jeroen de Beer

Reputation: 340

Get response after post camelContext

When I post in camel I get no response. The data is successfully processed, logged and posted without errors and warnings.

<camelContext id="camelId"  xmlns="http://camel.apache.org/schema/spring">
    <route id="pushItem" streamCache="true">
        <from uri="cxf:bean:pushItemCxfEndpoint" />
        <process ref="pushItemTransformer" />
        <log message="${body}"/>
        <setHeader headerName="CamelHttpMethod">
            <constant>POST</constant>
        </setHeader>
        <setBody>
            <simple>${body}</simple>
        </setBody>
        <to uri="http://endpoint/api/v1/products"/>
    </route>
</camelContext>

I'd like to receive a response from http://endpoint/api/v1/products.

Upvotes: 0

Views: 570

Answers (2)

Gediminas Siutilas
Gediminas Siutilas

Reputation: 36

<to uri="http://endpoint/api/v1/products"/>
<log message="Response code: ${in.header.CamelHttpResponseCode}"/>
<log message="Response text: ${in.header.CamelHttpResponseText}"/>
<log message="Response payload: ${body}"/>

Upvotes: 1

Greenev
Greenev

Reputation: 909

You could place whatever you want to do with the response just after you have sent your http request

<to uri="http://endpoint/api/v1/products"/>
<log message="${body}"/>

Upvotes: 1

Related Questions