6 Haziran 2018 Çarşamba

InboundChannel Adapter

Giriş
Açıklaması şöyle
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)...
Şeklen şöyledir
inbound-ca->someComponent->someOtherComponent->outbound-ca
İki çeşit Inbound Channel Adapter var. Açıklaması şöyle
There are two types of inbound channel adapters:

-MessageProducers
- MessageSources

MessageProducers 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.

MessageSources 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).
Açıklaması şöyle
Inbound Channel Adapters are represented by the SourcePollingChannelAdapter. All message driven channel Adapters are MessageProducerSupport or MessageGatewaySupport.
Örnek - jpa
Şöyle yaparız.
<channel id="newAssetChannel" />

<int-jpa:inbound-channel-adapter
  id="newAssetChannelAdapter"
  channel="newAssetChannel"
  entity-manager-factory="entityManagerFactory" 
  entity-class="com.foo.domain.Asset" 
  jpa-query="select a from Asset a 
    where (a.status = 'NEW' or a.status = 'UPDATED')
    and a.health = 'OK' ORDER BY a.priority DESC, a.updatedDate ASC"
  max-results="250">
  <poller fixed-rate="5000" max-messages-per-poll="1" />
</int-jpa:inbound-channel-adapter>
Örnek - file
Şöyle yaparız.
<int-file:inbound-channel-adapter directory="/app/download/client/" 
  id="clientFileAdapter" 
  channel="channelOne"
  scanner="myFileScanner" prevent-duplicates="true">
  <int:poller fixed-delay="1000" max-messages-per-poll="1"/>
</int-file:inbound-channel-adapter>
Örnek
Şöyle yaparız.
<int:inbound-channel-adapter ref="xxxTask" method="executeXXXTask" 
  channel="fileOutChannel">
  <int:poller cron="0 30 4 ? * *"/>
</int:inbound-channel-adapter>

Hiç yorum yok:

Yorum Gönder