Scott Parkerson schrieb:
On Sep 9, 2009, at 5:36 PM, Christian Schneider wrote:
I think you could take a look at Apache Camel. If you simply want to
send the soap message to jms you would set up a camel route like this:
from("http://localhost:9000/MyServicePort").to("jms://myQeueName")
Between the two you could insert some processing.
In this case, it's more like:
POST /api/sendfooRequest (JSON body) -> CXF (which validates, and
turns it into a POJO) -> ActiveMQ -> some other bean to process
Ok .. now I understand. You want to send the pojo to ActiveMQ not the
xml. In this case you build the service with CXF and can then use
Camel to simply send the pojo to ActiveMQ. You can do this by:
public class MyJsonServiceImpl implements MyJsonService {
@EndpointInject(uri="activemq:myqueue")
ProducerTemplate producer;
public void doSomething(MyObject o) {
producer.sendBody(o);
}
}
If you do not like to have the queue name in the annotation you can use
a direct endpoint and define the destination in the camel context. I
hope this is what you were searching for.
The full documentation can be found here:
http://camel.apache.org/pojo-producing.html
http://camel.apache.org/activemq.html
http://camel.apache.org/direct.html
Alternatively you can set up a CXF Endpoint in Camel. In this case you
do not need to write the implementation class.
http://camel.apache.org/cxf.html
So your route would look like:
<route>
<from uri="cxf:bean:routerEndpoint" />
<to uri="activemq:myqueue" />
</route>
If you only want to forward the request this is probably easier.
Btw. Camel also supports request reply in a route like this. So your
component that listens to jms can send a reply message back that is then
returned in the body of the http reply.
Greetings
Christian
I'd rather not have Camel manage the actual front-end response; I'd
rather have Camel process that after it's passed into the next phase.
If you only need a transparent bridge from http to jms you could take
a look at a project I did:
http://www.liquid-reality.de:8080/display/liquid/HTTP2JMSBridge
Good idea, but I still want CXF to do the processing before it gets to
JMS.
--sgp