You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Juergen Mayrbaeurl <ju...@hvb.sozvers.at> on 2006/04/26 11:05:52 UTC

ChainedComponent continues invoking services after failure

I'm using a chained component to do simple service orchestration. The first
component in the chain is a ValidateComponent and the second a simple
CopyTransformer:

<sm:activationSpec
	componentName="BPKAbfrageVerarbeitung"
	service="test:BPKAbfrageVerarbeitung"
	endpoint="BPKAbfrageVerarbeitung"
	destinationService="test:receiver">

	<sm:component>
		<bean xmlns=""
			class="org.apache.servicemix.components.util.ChainedComponent">
			<property name="services">
				<list>
					<bean class="javax.xml.namespace.QName">
						<constructor-arg value="http://www.sozialversicherung.at/zpvtest"/>
						<constructor-arg value="BPKAbfrageValidierung"/>
					</bean>
					<bean class="javax.xml.namespace.QName">
						<constructor-arg value="http://www.sozialversicherung.at/zpvtest"/>
						<constructor-arg value="BPKMockErgebnis"/>
					</bean>
				</list>
			</property>
		</bean>
	</sm:component>			
</sm:activationSpec>


<sm:activationSpec 
	componentName="BPKAbfrageValidierung"
	service="test:BPKAbfrageValidierung"
	endpoint="BPKAbfrageValidierung">
	<sm:component>
	  		  	<bean
class="org.apache.servicemix.components.validation.ValidateComponent">
      		<property name="schemaResource" 
      			value="ZMRBPK.xsd"/>
	    		</bean>
	</sm:component>
</sm:activationSpec>

If the validations fails, the ValidateComponent throws an FaultException
which will be catched by itself in
TransformComponentSupport:onMessageExchange. PojoSupport:fail gets called,
which sets the fault in the MessageExchange.
In the next call to ChainedComponent:invokeService the Status of
MessageExchange is only checked for ExchangeStatus.ERROR. Therefore the
ChainedComponent continues to invoke the next service in the chain, which
should not happen.

My second service in the ChainedComponent is a CopyTransformer. In my
context (and because of not stopping to invoke the services) the component
gets called with NULL for the IN message, causing a NULL pointer exception,
because the CopyTransformer doesn't check the parameter value for the IN
message. The CopyTransformer should check the parameters in
CopyTransformer:transform() and throw an exception, if NULL values are
passed in (or do nothing, if the from is NULL).

Kind regards
Juergen
--
View this message in context: http://www.nabble.com/ChainedComponent-continues-invoking-services-after-failure-t1510668.html#a4097890
Sent from the ServiceMix - User forum at Nabble.com.


Re: ChainedComponent continues invoking services after failure

Posted by Guillaume Nodet <gn...@gmail.com>.
On 4/26/06, Juergen Mayrbaeurl <ju...@hvb.sozvers.at> wrote:
>
> A bug in ChainedComponent. Will it be fixed or replaced by the component
> you've mentioned?

If someone contributes a patch, i will fix i ;)

>
> And what about the CopyTransformer?

This point is arguable i guess, as the exchange is not valid.
ServiceMix only supports the 4 standard MEPs and they always have an
input message.  The container should maybe check that the message has
been set before allowing the exchange to be sent.

Cheers,
Guillaume Nodet

>
> Juergen
> --
> View this message in context: http://www.nabble.com/ChainedComponent-continues-invoking-services-after-failure-t1510668.html#a4098010
> Sent from the ServiceMix - User forum at Nabble.com.
>
>

Re: ChainedComponent continues invoking services after failure

Posted by Juergen Mayrbaeurl <ju...@hvb.sozvers.at>.
A bug in ChainedComponent. Will it be fixed or replaced by the component
you've mentioned?

And what about the CopyTransformer?

Juergen
--
View this message in context: http://www.nabble.com/ChainedComponent-continues-invoking-services-after-failure-t1510668.html#a4098010
Sent from the ServiceMix - User forum at Nabble.com.


Re: ChainedComponent continues invoking services after failure

Posted by Guillaume Nodet <gn...@gmail.com>.
This is a bug.
You should be able to achieve the desired behavior using the new EIP
component.  Take a look at
http://servicemix.org/servicemix-eip#servicemix-eip-StaticRoutingSlip.
Errors and faults are reported back to the consumer.

Cheers,
Guillaume Nodet

On 4/26/06, Juergen Mayrbaeurl <ju...@hvb.sozvers.at> wrote:
>
> I'm using a chained component to do simple service orchestration. The first
> component in the chain is a ValidateComponent and the second a simple
> CopyTransformer:
>
> <sm:activationSpec
>         componentName="BPKAbfrageVerarbeitung"
>         service="test:BPKAbfrageVerarbeitung"
>         endpoint="BPKAbfrageVerarbeitung"
>         destinationService="test:receiver">
>
>         <sm:component>
>                 <bean xmlns=""
>                         class="org.apache.servicemix.components.util.ChainedComponent">
>                         <property name="services">
>                                 <list>
>                                         <bean class="javax.xml.namespace.QName">
>                                                 <constructor-arg value="http://www.sozialversicherung.at/zpvtest"/>
>                                                 <constructor-arg value="BPKAbfrageValidierung"/>
>                                         </bean>
>                                         <bean class="javax.xml.namespace.QName">
>                                                 <constructor-arg value="http://www.sozialversicherung.at/zpvtest"/>
>                                                 <constructor-arg value="BPKMockErgebnis"/>
>                                         </bean>
>                                 </list>
>                         </property>
>                 </bean>
>         </sm:component>
> </sm:activationSpec>
>
>
> <sm:activationSpec
>         componentName="BPKAbfrageValidierung"
>         service="test:BPKAbfrageValidierung"
>         endpoint="BPKAbfrageValidierung">
>         <sm:component>
>                                 <bean
> class="org.apache.servicemix.components.validation.ValidateComponent">
>                 <property name="schemaResource"
>                         value="ZMRBPK.xsd"/>
>                         </bean>
>         </sm:component>
> </sm:activationSpec>
>
> If the validations fails, the ValidateComponent throws an FaultException
> which will be catched by itself in
> TransformComponentSupport:onMessageExchange. PojoSupport:fail gets called,
> which sets the fault in the MessageExchange.
> In the next call to ChainedComponent:invokeService the Status of
> MessageExchange is only checked for ExchangeStatus.ERROR. Therefore the
> ChainedComponent continues to invoke the next service in the chain, which
> should not happen.
>
> My second service in the ChainedComponent is a CopyTransformer. In my
> context (and because of not stopping to invoke the services) the component
> gets called with NULL for the IN message, causing a NULL pointer exception,
> because the CopyTransformer doesn't check the parameter value for the IN
> message. The CopyTransformer should check the parameters in
> CopyTransformer:transform() and throw an exception, if NULL values are
> passed in (or do nothing, if the from is NULL).
>
> Kind regards
> Juergen
> --
> View this message in context: http://www.nabble.com/ChainedComponent-continues-invoking-services-after-failure-t1510668.html#a4097890
> Sent from the ServiceMix - User forum at Nabble.com.
>
>