Spring Integration - Flow process with erro handling -


i'm continuing study si , in same time i'm trying build application.

my application flow this:

  1. read xml file , split each tag
  2. each tag have define attribute called "interval", , need create job repeated, according value.
  3. when job execution terminated, need invoke web service store information
  4. if wbs invokation fails, try send info email

right i'm arrived on point 1 ( :d ) of flow, i'm trying move forward , first check error handling (point 4 of flow).

this actual configuration have , works fine splitting tag , invoking right service-activator:

<context:component-scan base-package="it.mypkg" />  <si:poller id="poller" default="true" fixed-delay="1000"/>  <si:channel id="rootchannel" />  <si-xml:xpath-splitter id="mysplitter" input-channel="rootchannel" output-channel="routerchannel" create-documents="true">     <si-xml:xpath-expression expression="//service" /> </si-xml:xpath-splitter>  <si-xml:xpath-router id="router" input-channel="routerchannel" evaluate-as-string="true">     <si-xml:xpath-expression expression="concat(name(./node()), 'channel')" /> </si-xml:xpath-router>  <si:service-activator input-channel="servicechannel" output-channel="endchannel">     <bean class="it.mypkg.service" /> </si:service-activator> 

the endchannel need receive messages several channel (sent router) , invoke wbs. right i'm jkust creating classes check if flow works or not.

the remaining part of applicationcontext.xml this:

  <!-- create poller used endchannel --> <si:poller id="poller" default="true" fixed-delay="1000" error-channel="failedinvocationchannel" />  <!--- take messages servicechannel , redirect endchannel, responsable receive messages channels created router --> <si:service-activator input-channel="servicechannel" output-channel="endchannel">     <bean class="it.mypkg.service" /> </si:service-activator>   <!-- end channel queue --> <si:channel id="endchannel">     <si:queue capacity="10"/> </si:channel>  <!-- messages taken queue.. --> <si:service-activator input-channel="endchannel">     <bean class="it.mypkg.invokator" /> </si:service-activator>  <!-- service activator handle errors on queue --> <si:channel id="failedinvocationchannel" />  <si:service-activator input-channel="failedinvocationchannel">     <bean class="it.mypkg.resubmitter" /> </si:service-activator> 

but when run application got error:

exception in thread "main" org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.integration.handler.messagehandlerchain#0': cannot create inner bean 'org.springframework.integration.handler.messagehandlerchain#0$child#1.handler' of type [org.springframework.integration.config.serviceactivatorfactorybean] while setting bean property 'handlers' key [1]; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.integration.handler.messagehandlerchain#0$child#1.handler': factorybean threw exception on object creation; nested exception java.lang.illegalargumentexception: target object of type [class org.springframework.integration.channel.queuechannel] has no eligible methods handling messages.     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolveinnerbean(beandefinitionvalueresolver.java:313)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvevalueifnecessary(beandefinitionvalueresolver.java:122)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvemanagedlist(beandefinitionvalueresolver.java:382)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvevalueifnecessary(beandefinitionvalueresolver.java:157)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applypropertyvalues(abstractautowirecapablebeanfactory.java:1481)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1226)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:543)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306)     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:197)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:772)     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:838)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:537)     @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:197)     @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:172)     @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:158) 

i've read lot , i'm little bit confused components can used... maybe error because i'm trying use components in wrong way...

edit: configuration updated error-channel on poller , removed chain handle error

<si:service-activator ref="endchannel" method="dispatch" /> 

you can't use ref channel in service activator.

also, it's better give elements chains id exceptions easier debug.

also, shouldn't manipulating errorchannel header; it's better add error-channel poller , route error flow way.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -