[resolved] How to insert the payload in a cCXFRS POST request into ActiveMQ

One Star

[resolved] How to insert the payload in a cCXFRS POST request into ActiveMQ

Hi All, 
        I am looking for a process where the payload in a REST Post request is queued in an ActiveMQ Queue. In Talend Mediation perspective the cCXFRS component seems to have the capability to provide a REST Endpoint. However, the cCXFRS component expects a java bean class provided to it.
        I guess a bean which does not do any transformation on the payload needs to be created because the cCXFRS component expects a bean class in POST request. Kindly correct me if i am wrong.
       Can anyone help with the process to achieve the same?.  
Thank You

Accepted Solutions
Sixteen Stars

Re: [resolved] How to insert the payload in a cCXFRS POST request into ActiveMQ

Setup the cCXFRS to receive POST method calls. A simple config to receive XML and return XML is below....

The connect it to the configured cAMQP. The messages passed in routes are called Exchanges. The contain and IN and and OUT message. The payload (I am assuming XML) will be in the IN message. If you want to analyse this in Java, you would put a cProcessor component between your cCXFRS and cAMQP components and use some code similar to the below to take a look at your message (assuming it can be read as a String in this example)....
System.out.println(exchange.getIn().getBody(String.class));

All Replies
Sixteen Stars

Re: [resolved] How to insert the payload in a cCXFRS POST request into ActiveMQ

You can use the cAMQP component to do this. Take a look here for details (https://help.talend.com/search/all?query=cAMQP&content-lang=en).
One Star

Re: [resolved] How to insert the payload in a cCXFRS POST request into ActiveMQ

Hi rhall_2.0,
                 Thanks for your information. I guess cAMQP is to push data into ActiveMQ similar to cJMS. That is helpful in identifying the component to push data into ActiveMQ queue.
                 Can you please advice on how to get the payload passed in the POST request to the endpoint in cCXFRS component?
Thank You
Sixteen Stars

Re: [resolved] How to insert the payload in a cCXFRS POST request into ActiveMQ

Setup the cCXFRS to receive POST method calls. A simple config to receive XML and return XML is below....

The connect it to the configured cAMQP. The messages passed in routes are called Exchanges. The contain and IN and and OUT message. The payload (I am assuming XML) will be in the IN message. If you want to analyse this in Java, you would put a cProcessor component between your cCXFRS and cAMQP components and use some code similar to the below to take a look at your message (assuming it can be read as a String in this example)....
System.out.println(exchange.getIn().getBody(String.class));
One Star

Re: [resolved] How to insert the payload in a cCXFRS POST request into ActiveMQ

Hi rhall_2.0,
                Thanks for your help. The trick which worked for me is to change the body to String data type and push it into the queue.Earlier, i was not able to push the body into the queue as the queue did not accept document objects in the body.
                   Thanks again for "exchange.getIn().getBody(String.class)" which helps me to get the body in the request.


Thank You