On 2/12/07, Liu, Jervis <[EMAIL PROTECTED]> wrote:



> -----Original Message-----
> From: Polar Humenn [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 09, 2007 1:11 AM
> To: [email protected]
> Subject: Re: Proposal for chaning CXF Interceptor APIs. WAS: RE: When
> should we close the handlers in CXF?
>
>
> Okay, I'm going to reply to my own message, because after a coffee I
> have come to some nirvana about this issue.
>
> The reason you want an onFinish() call is to address the subchain
> problem.  In one of the emails below it is stated:
>
>        A. MessageSenderInterceptor:  call conduit.close(message) after
>     the complete chain    has been traversed.
>
>
> I presume that you want A.handleMessage() to be called to do
> some things
> (like install more interceptors) and then after everything
> has been done
> to the message, you want A.onFinish() called to call
> conduit.close(message).
>
> My basic question is, why isn't the conduit.close(message)
> called in a
> separate interceptor's handleMessage() call?
>
Actually, I have thought about this option as well. For every interceptor
that needs a terminal action, we will need a pair of interceptors. For
example, the SoapOutInterceptor will be SoapOutStartInterceptor and
SoapOutEndInterceptor, SoapOutStartInterceptor writes the start element of
SOAP Body and Envelope, while SoapOutEndInterceptor writes the end element
of SOAP Body and Envelope. Same thing applies to conduit.close(message),
we will need a MessageSenderEndInterceptor to call conduit.close(message)
(or any other interceptors that is appropriate). This definitely works, and
this can achieve exact same execution path as we can do with onComplete(),
it just occurs to me that there are too many interceptors we have to write
;-)


Agreed. It could be done via another interceptor, but its a common enough
case that we'd like to make it simpler.

On a related note I would like to see the method named onTermination() -
this would imply "on termination of the chain take this action..." which
would give interceptors a chance to close resources associated with the
message. I'm -1 on the current "postHandleMessage" method name.

--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to