2015-11-28 96 views
0

所以我上有数百个flows.All这些流动的弹簧集成应用程序的工作基本上代表了应用程序的服务像Spring集成流

Report Generation 
Customer Search 
Get Customer Transactions 
Customer Activity Stream 
etc. 

我想验证发送到这些流请求(基本上检查参数规格被满足),所以我为验证请求分别创建了另一个流程,以便发送到上述服务的任何请求将首先通过验证流程。 现在我想知道如何将其纳入服务流程中。

详见下文。

验证流程--->

<int:channel id="svcExeGovernorEntryLoggerChannel"/> 

    <int:channel id="svcExeGovernorEntryRespChannel" > 
     <int:interceptors> 
      <int:wire-tap channel="svcExeGovernorEntryLoggerChannel"/> 
     </int:interceptors> 
    </int:channel> 

    <int:transformer id="serviceExecutionGovernorEntry" ref="serviceExecutionGovernor" method="serviceExecutionEntry" input-channel="svcExeGovernorEntryReqChannel" output-channel="svcExeGovernorEntryRespChannel"/> 

    <int:logging-channel-adapter id="svcExeGovernorEntryLogger" channel="svcExeGovernorEntryLoggerChannel" logger-name="svcExeGovernor-entry-logger" /> 

</beans> 

我尝试使用下面的桥梁,但这些不工作,它的输出发送另一个服务。

<int:channel id="customerCrawlReqChannel"> 
     <int:interceptors> 
      <int:wire-tap channel="customerCrawlLoggerChannel"/> 
     </int:interceptors> 
    </int:channel> 
    <int:channel id="customerCrawlRespChannel"> 
     <int:interceptors> 
      <int:wire-tap channel="customerCrawlLoggerChannel"/> 
     </int:interceptors> 
    </int:channel> 
    <int:channel id="customerCrawlLoggerChannel"/> 
    <int:channel id="customerCrawlResultChannel"> 
     <int:interceptors> 
      <int:wire-tap channel="customerCrawlLoggerChannel"/> 
     </int:interceptors> 
    </int:channel> 
    <int:channel id="customerCrawlJsonChannel"/> 

    <http:inbound-gateway id="customerCrawlInboundGateway" 
          supported-methods="POST" 
          mapped-request-headers="User-Agent,Content-Type" 
          request-payload-type="java.lang.String" 
          path="/service/customercrawl" 
          reply-timeout="50000" 
          request-channel="customerCrawlReqChannel" 
          reply-channel="customerCrawlRespChannel">   
    </http:inbound-gateway> 


    <int:bridge input-channel="customerCrawlReqChannel" output-channel="svcExeGovernorEntryReqChannel"/> 


    <int:transformer id="customerCrawlPrvder" ref="crawlCustomerProviderService" method="crawlCustomer" input-channel="svcExeGovernorEntryRespChannel" output-channel="customerCrawlResultChannel"/>   


    <int:header-enricher input-channel="customerCrawlResultChannel"  output-channel="customerCrawlRespChannel"> 
     <int:header name="Content-Type" expression="'application/json'" /> 
    </int:header-enricher>  
    <int:logging-channel-adapter 
    id="customerCrawlLogger"channel="customerCrawlLoggerChannel" logger- 
    name="customerCrawl-logger"/> 

对此有任何建议,请提前致谢。

回答

1

如果有多个订户svcExeGovernorEntryRespChannel那么这些响应将循环分发给这些消费者;在框架中没有任何东西可以告诉哪个用户流返回。

如果你想添加相同的验证流程,以在同样的情况下多个流,使用中等流动网关...

<int:service-activator 
      input-channel="customerCrawlReqChannel" 
      output-channel="customerCrawlReqAfterValidationChannel" 
      ref="validationGW" /> 

<int:gateway id="validationGW" 
      default-request-channel="svcExeGovernorEntryLoggerChannel" 
      default-reply-channel="svcExeGovernorEntryRespChannel" /> 

这就像输入消息作为Java中的一个方法调用一个参数和输出消息的结果。您也可以使用routing slip。验证后,设置到下一个元素的路径,并从验证流程的最后一个元素中移除输出通道。

+0

嗨加里,谢谢,看起来像这样的作品,我已经完成了3个服务流程到目前为止,它的罚款。再次感谢 – codereal

+0

酷;在此习惯上将答案标记为“接受”(在投票下的绿色支票/勾号)。它将帮助其他用户搜索类似的问题。 –