可以理解成一个队列,在该队列不同节点部分进行相应的逻辑操作,实现轻量级消息传递
2、结构流程
3、代码结构:
3.1配置文件:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:integration="http://www.springframework.org/schema/integration" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd"> <context:annotation-config /> <context:component-scan base-package="ch.javaee.integration.example.helloWorld"/> <!-- this channel is called by the application and the message is passed to it --> <integration:channel /> <integration:channel /> <!-- this channel receive the modified message --> <integration:channel /> <integration:channel /> <!-- this service transform the message in input-channel and send the result to output-channel --> <!-- the service method to call is referenced in explicitly --> <integration:service-activator input-channel="inputChannel" ref="myTestProducerService" method="poll" output-channel="middleChannel"/> <!-- this service receives a message and pass it to printerService --> <!-- the method that consumes the message is implicitly defined by the @ServiceActivator annotation or it should be the only method in the class --> <integration:service-activator input-channel="middleChannel" ref="myTestConsumerService" output-channel="outputChannel"/> <integration:service-activator input-channel="outputChannel" ref="myTestFinalConsumerService" output-channel="finalChannel"/> </beans>