Friday, December 14, 2012

Spring Integration:Multiple methods routing




  <int:chain
      input-channel="inboundRequestChannel"
      output-channel="outboundResponseChannel">
    <int:header-enricher>
      <int:header name="service" ref="data-access.service" />
    </int:header-enricher>
    <int:service-activator>
       <int-groovy:script>headers['service']."${headers['METHOD_NAME']}"(payload)</int-groovy:script>
    </int:service-activator>
  </int:chain>

  <!-- The data access services instance -->
  <bean id="data-access.service" class="TestPackagesService" />


  <int:gateway id="gateway"
               service-interface="TestPackagesServiceGateway"
               default-request-channel="inboundRequestChannel"
               default-reply-channel="outboundResponseChannel"
               default-reply-timeout="10000"
               error-channel=“outboundErrorChannel">

    <int:method name="getTestSpec">
      <int:header name="METHOD_NAME" value="getTestSpec" />
    </int:method>
    <int:method name="saveTestSpec">
      <int:header name="METHOD_NAME" value="saveTestSpec" />
    </int:method>

  </int:gateway>






1 comment: