You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Gianfranco Boccalon <gi...@eng.it> on 2008/04/07 17:03:38 UTC

ProviderEndpoint support for errors

Hi all,
I'm implementing a JBI component extending the class ProviderEndPoint, 
implementing the methods processInOnly and processInOut.
I wonder about exception management on this class: if the methods 
processInOnly and processInOut throw an exception, no fail message is sent.
Also, if within these methods I try sending a fault message, I get an 
error from ServiceMix because in the "process" method of 
ProviderEndPoint, the class try to send a normal response message.
I think that the calls to processInOnly and processInOut should be 
surrounded with a try/catch block that in case of exception send a fault 
message, otherwise ProviderEndPoint does the normal processing.

What do you think about this ?

Regards
Gianfranco Boccalon


Re: ProviderEndpoint support for errors

Posted by Guillaume Nodet <gn...@gmail.com>.
Sure.  Could you raise a JIRA for that please ?

On Wed, Apr 9, 2008 at 3:47 PM, Gianfranco Boccalon <gb...@tiscali.it>
wrote:

> You're partially right: the exception is caught in
> BaseLifeCycle.onMessageExchange method, but my exception is a
> java.lang.NoClassDefFoundError that is a Throwable, while the catch is only
> for Exception. This means that in this case no message is sent on the NMR.
> If I surround my code with a try/catch, it doesnt work also, because I
> send a fault message and the ProviderEndPoint tries to send the normal
> message.
>
> It's possible to change the catch block in BaseLifeCycle.onMessageExchange
> to manage also Throwables ?
>
>
>
>
> Guillaume Nodet ha scritto:
>
>  The call to processInOnly or processInOut is already surrounded by a
> > try/catch block that transforms the exception into an error, which is
> > set on
> > the jbi exhange being processed and sent back to the consumer.  I don't
> > really see any other solution: business faults can't be know by the
> > component because they are part of the service description.  If you
> > implement a service using the ProviderEndpoint, then you can catch
> > exceptions and translate those into faults instead of errors, but the
> > component can not really do that in a generic way.
> >
> > On Mon, Apr 7, 2008 at 5:03 PM, Gianfranco Boccalon <
> > gianfranco.boccalon@eng.it> wrote:
> >
> >
> >
> > > Hi all,
> > > I'm implementing a JBI component extending the class ProviderEndPoint,
> > > implementing the methods processInOnly and processInOut.
> > > I wonder about exception management on this class: if the methods
> > > processInOnly and processInOut throw an exception, no fail message is
> > > sent.
> > > Also, if within these methods I try sending a fault message, I get an
> > > error from ServiceMix because in the "process" method of
> > > ProviderEndPoint,
> > > the class try to send a normal response message.
> > > I think that the calls to processInOnly and processInOut should be
> > > surrounded with a try/catch block that in case of exception send a
> > > fault
> > > message, otherwise ProviderEndPoint does the normal processing.
> > >
> > > What do you think about this ?
> > >
> > > Regards
> > > Gianfranco Boccalon
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: ProviderEndpoint support for errors

Posted by Gianfranco Boccalon <gb...@tiscali.it>.
You're partially right: the exception is caught in 
BaseLifeCycle.onMessageExchange method, but my exception is a 
java.lang.NoClassDefFoundError that is a Throwable, while the catch is 
only for Exception. This means that in this case no message is sent on 
the NMR.
If I surround my code with a try/catch, it doesnt work also, because I 
send a fault message and the ProviderEndPoint tries to send the normal 
message.

It's possible to change the catch block in 
BaseLifeCycle.onMessageExchange to manage also Throwables ?




Guillaume Nodet ha scritto:
> The call to processInOnly or processInOut is already surrounded by a
> try/catch block that transforms the exception into an error, which is set on
> the jbi exhange being processed and sent back to the consumer.  I don't
> really see any other solution: business faults can't be know by the
> component because they are part of the service description.  If you
> implement a service using the ProviderEndpoint, then you can catch
> exceptions and translate those into faults instead of errors, but the
> component can not really do that in a generic way.
>
> On Mon, Apr 7, 2008 at 5:03 PM, Gianfranco Boccalon <
> gianfranco.boccalon@eng.it> wrote:
>
>   
>> Hi all,
>> I'm implementing a JBI component extending the class ProviderEndPoint,
>> implementing the methods processInOnly and processInOut.
>> I wonder about exception management on this class: if the methods
>> processInOnly and processInOut throw an exception, no fail message is sent.
>> Also, if within these methods I try sending a fault message, I get an
>> error from ServiceMix because in the "process" method of ProviderEndPoint,
>> the class try to send a normal response message.
>> I think that the calls to processInOnly and processInOut should be
>> surrounded with a try/catch block that in case of exception send a fault
>> message, otherwise ProviderEndPoint does the normal processing.
>>
>> What do you think about this ?
>>
>> Regards
>> Gianfranco Boccalon
>>
>>
>>     
>
>
>   


Re: ProviderEndpoint support for errors

Posted by Guillaume Nodet <gn...@gmail.com>.
The call to processInOnly or processInOut is already surrounded by a
try/catch block that transforms the exception into an error, which is set on
the jbi exhange being processed and sent back to the consumer.  I don't
really see any other solution: business faults can't be know by the
component because they are part of the service description.  If you
implement a service using the ProviderEndpoint, then you can catch
exceptions and translate those into faults instead of errors, but the
component can not really do that in a generic way.

On Mon, Apr 7, 2008 at 5:03 PM, Gianfranco Boccalon <
gianfranco.boccalon@eng.it> wrote:

> Hi all,
> I'm implementing a JBI component extending the class ProviderEndPoint,
> implementing the methods processInOnly and processInOut.
> I wonder about exception management on this class: if the methods
> processInOnly and processInOut throw an exception, no fail message is sent.
> Also, if within these methods I try sending a fault message, I get an
> error from ServiceMix because in the "process" method of ProviderEndPoint,
> the class try to send a normal response message.
> I think that the calls to processInOnly and processInOut should be
> surrounded with a try/catch block that in case of exception send a fault
> message, otherwise ProviderEndPoint does the normal processing.
>
> What do you think about this ?
>
> Regards
> Gianfranco Boccalon
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/