2014-12-03 165 views
1

我想知道解决这种集成化方案的方式:Spring集成:JDBC单查询Web服务

  • 执行不同的查询选择从数据库中X元素。我是 寻找一个入站适配器没有池,因为它只是执行一次查询所需的 。虽然,查询结果 只会生成一个输出。
  • 使用此数据构建S​​OAP请求(通用Web服务)
  • 将此SOAP请求发送到Web服务并等待异步响应。

但是,还有必要将所有此方案都部署在Tomcat服务器上的WAR文件中。我从Spring MVC + Spring集成框架部署应用程序,但是我不会有任何控制器。在Tomcat上加载上下文时是否可以执行该应用程序?

我的下一个技术方面的工作:

  • Spring集成
  • Spring MVC的一战部署
  • 调度(石英或@Scheduled)
  • 春WS

问候

回答

0

既然你说你更愿意select上的应用程序启动和只有一次,你可以使用:

<int-event:inbound-channel-adapter channel="jdbcChannel" 
     event-types="org.springframework.context.event.ContextRefreshedEvent" 
     payload-expression="''"/> 

<int-jdbc:outbound-gateway query="SELECT * FROM ..."/>

等方面WebService的。

UPDATE

既然你说你周围Anotation配置,可以考虑使用Spring Integration Java DSL

@Configuration配置<int-event:inbound-channel-adapter>你应该这样做:

@Bean 
    @SuppressWarnings("unchecked") 
    public MessageProducer ApplicationEventListeningMessageProducer() { 
     ApplicationEventListeningMessageProducer producer = new ApplicationEventListeningMessageProducer(); 
     producer.setEventTypes(ContextRefreshedEvent.class); 
     producer.setPayloadExpression("''"); 
     producer.setOutputChannel(jdbcChannel()); 
     return producer; 
    } 

ContextRefreshedEvent信息,你可以从它的JavaDoc或Spring Framework Manual得到。

+0

谢谢阿尔乔姆。出站网关似乎是一个很好的解决方案。由于我只使用带注释的配置工作,你能指出我在哪里可以找到关于ContextRefreshedEvent的更多信息? – crm86 2014-12-03 11:24:09

+1

为注释配置变体添加了一个样本。 – 2014-12-03 11:54:43

+0

有什么关于:带注释。我试图创建一个JdbcOutboundGateway,但我得到'没有订户'异常 – crm86 2014-12-03 18:46:28