Asynchronous behaviour with CXF endpoint for SOAP services
Issue
- Please provide some insights in to the
asynchronous/synchronousbehaviour ofcxf:endpointfor receiving the soap requests. - My first question is , what is the default invocation mechanism for
cxf:endpointserver and client service ? Does thecxf:endpointserve the request in an asynchronous manner by default ? I have the following route
<route id="RECIEVER_MODULE">
<from uri="cxf:bean:CURRENCY_EXCHANGE_RATE" />
<log message="RECIEVING MODULE SECTION ${body}" loggingLevel="INFO"
logName="INPUT" />
<delay>
<constant>10000</constant>
</delay>
<to uri="file:c:\\input1" />
</route>
- From
SOAPUIi have triggered one request and the thread waited for 10008 millisecs. On debugging I found that its waiting in the following piece of code
private Object asyncInvoke(org.apache.cxf.message.Exchange cxfExchange, final Continuation continuation)
{
synchronized (continuation)
{
if (continuation.isNew())
{
final org.apache.camel.Exchange camelExchange = perpareCamelExchange(cxfExchange);
CxfConsumer.LOG.trace("Suspending continuation of exchangeId: {}", camelExchange.getExchangeId());
continuation.suspend(0L);
CxfConsumer.this.getAsyncProcessor().process(camelExchange, new AsyncCallback()
{
public void done(boolean doneSync)
{
synchronized (continuation)
{
CxfConsumer.LOG.trace("Resuming continuation of exchangeId: {}", camelExchange.getExchangeId());
continuation.setObject(camelExchange);
continuation.resume();
}
}
});
}
else if (continuation.isResumed())
{
org.apache.camel.Exchange camelExchange = (org.apache.camel.Exchange)continuation.getObject();
setResponseBack(cxfExchange, camelExchange);
}
}
return null;
}
continuation.suspend(0L)suspend the incoming thread , and the request thread needs to wait for the doneSync value to be true. I want to handle the request in an asynchronous manner , ie I dont want the client to wait for the route processing to complete.The thread should be released at the same moment it send the request fromSOAPUi?
Environment
- Red Hat JBoss Fuse
- 6.0.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.