...
You can find the more information for the CXF architecture document herehttp://cwiki.apache.org/CXF20DOC/cxf-architecture.html.
Integrate Camel's into CXF transport layer
You can Camel transport for CXF implements the CXF transport API, you could treat it as a normal transport implementation. But you need to initiate a camel context for the camel transport and do the routing and mediation work as you want in the CXF transport layer than pass the message to CXF Messaging layer for the WS* message handling.
Here we connect a camel consumer with the Camel conduit and a camel producer with the Camel Destination by using the endpoint URL in a certain Camel context.
What I can do with the Camel transport for CX
Configure the Camel context
...
Configure the Camel context
Basically , Camel transport factory is in charge of Camel transport, and CXF core will load this factory when you put the camel-cxf.jar into the class path. Since you need to pass the camel context into the transport layer , you could do it in a programmatic way or with spring configuration.
Setting the Camel context in a programmatic way
Camel transport provides a setConetxt method that you could use to set the Camel context into the transport factory. If you want this factory take effect, you need to register the factory into the CXF bus. Here is a full example for you.
Code Block | ||||
---|---|---|---|---|
| ||||
BusFactory bf = BusFactory.newInstance();
//setup the camel transport for the bus
Bus bus = bf.createBus();
CamelTransportFactory camelTransportFactory = new CamelTransportFactory();
//set the context here to the transport factory;
camelTransportFactory.setCamelContext(context);
// register the conduit initiator
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
cim.registerConduitInitiator(CamelTransportFactory.TRANSPORT_ID, camelTransportFactory);
// register the destination factory
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
dfm.registerDestinationFactory(CamelTransportFactory.TRANSPORT_ID, camelTransportFactory);
// set the default bus for
BusFactory.setDefaultBus(bus);
|