Spring集成 - 入站和出站通道适配器
入站和出站通道适配器之间的根本区别是什么?
任何示例都会非常有用。
Any examples would be very helpful.
我已经回顾了Spring文档,这种定向区别对我来说并不清楚。我支持配置了出站通道适配器的应用程序,但我发现行为计数器与出站标签直观相符。此适配器获取外部文件,然后将其带入到我们解析文件的应用程序并保留数据。
I have reviewed the Spring docs and this "directional" distinction is not clear to me. I support an application that has an outbound-channel-adapter configured, but I find the behavior counter intuitive with the outbound label. This adapter gets an external file, then brings it in to the application where we parse the file and persist the data.
这类似于这个问题,但我想更关注频道适配器,并希望获得更多反馈!
This is similar to this question, but I wanted to focus more generally on channel adapters, and hopefully get more feedback!
谢谢!
频道适配器用于单向集成(网关是双向的)。
Channel adapters are for one-way integration (gateways are bidirectional).
具体而言,入站适配器位于流的开头,出站适配器终止流。流通常被渲染(并且在概念上被认为是从左向右流动)...
Concretely, inbound adapters are at the beginning of a flow, outbound adapters terminate a flow. Flows are typically rendered (and conceptually thought of as flowing from left to right)...
inbound-c-a->someComponent->someOtherComponent->outbound-ca
(其中 - >
代表一个频道。
有两种类型的入站通道适配器:
There are two types of inbound channel adapters:
-
MessageProducer
s -
MessageSource
s
-
MessageProducer
s -
MessageSource
s
MessageProducer
s被称为消息驱动,即他们单方面生成消息一旦完全异步的方式,它们一旦启动就会出现;示例是JMS消息驱动适配器,TCP入站通道适配器,IMAP空闲(邮件)通道适配器等。
MessageProducer
s are termed "message-driven" i.e. they unilaterally produce messages in a completely asynchronous manner, as soon as they are started; examples are JMS message-driven adapter, TCP inbound channel adapter, IMAP Idle (mail) channel adapter, etc.
MessageSource $ c $另一方面,c> s被轮询 - 带有一些触发器的
poller
会导致框架向源询问消息;触发器可以是固定速率,cron表达式等。示例是(S)FTP适配器,邮件入站适配器(POP3.IMAP)。
MessageSource
s on the other hand are polled - a poller
with some trigger causes the framework to ask the source for a message; the trigger can be on a fixed rate, cron expression etc. Examples are the (S)FTP adapters, Mail inbound adapter (POP3. IMAP).
出站适配器的示例是邮件出站适配器(SMTP)。
Examples of outbound adapters are Mail outbound adapter (SMTP).
网关是双向的(请求/回复)。
Gateways are two-way (request/reply).
入站网关是一些外部系统发送请求和Spring Integration回复的地方。
Inbound gateways are where some external system sends a request and Spring Integration replies.
出站网关是Spring Integration发出请求和一些外部系统回复的地方。
Outbound gateways are where Spring Integration makes the request and some external system replies.
我希望能够解决问题。