cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Sosnoski <...@sosnoski.com>
Subject Re: Postponing or blocking message delivery from interceptor
Date Thu, 20 Jan 2011 07:49:53 GMT
On 01/20/2011 08:19 AM, Daniel Kulp wrote:
> On Wednesday 19 January 2011 5:24:58 am Dennis Sosnoski wrote:
>   
>> ...
>>
>> In order to implement the receive handling, I need to be able to
>> short-circuit the processing of an in-bound message in an interceptor so
>> that no further processing is done at this time but the appropriate
>> transport response goes back to the sender (such as an HTTP 200 code). 
>>     
> Take a look at the OneWayInInterceptor for this.   Basically, it calls back 
> into the destination with basically and empty message to notify the 
> destination that we're "done" with this.
>   

Do you mean org.apache.cxf.interceptor.OneWayProcessorInterceptor? That
was the closest I could find to OneWayInInterceptor, which uses this
code to send the empty message back:

    Message partial = createMessage(message.getExchange());
    partial.remove(Message.CONTENT_TYPE);
    partial.setExchange(message.getExchange());
    Conduit conduit = message.getExchange().getDestination()
        .getBackChannel(message, null, null);
    if (conduit != null) {
        //for a one-way, the back channel could be
        //null if it knows it cannot send anything.
        conduit.prepare(partial);
        conduit.close(partial);
    }

The WS-RM code does implement duplicate message checks if AtMostOnce is
specified (in org.apache.cxf.ws.rm.DestinationSequence), in which case
it throws an exception that goes all the way up the call stack to
PhaseInterceptorChain. I'd think that would result in a Fault response
to the client when using two-way calls, though - so it really needs to
be handled using the above type of approach instead, right?

Incidentally, the DestinationSequence code logs a duplicate message at
SEVERE level. Shouldn't this really be INFO level, for an event which is
interesting but not really any kind of error?


>> I
>> also need to be able to later resume processing of an in-bound message
>> from the point it left off. How can I best do this in CXF?
>>     
> Also look at the OneWayInInterceptor.  :-)    You can just pause the chain and 
> store the chain someplace.  When ready, restart it.   
>   

Yes, I see. Thanks for the pointer!

  - Dennis

Mime
View raw message