Skip to content
This repository was archived by the owner on Jul 9, 2022. It is now read-only.

Message Channel

olegz edited this page Jun 5, 2012 · 20 revisions

EIP reference for Message Channel can be found here - http://www.eaipatterns.com/MessageChannel.html

Continuation from all types of channels could be expressed using '-->' operator. If you need to dispatch a Message to multiple subscribers simply provide an array of subscriber compositions. See an example [here] (https://github.com/SpringSource/spring-integration-scala/blob/master/src/test/scala/demo/DSLUsageDemo.scala#L78)

We currently support several types of Message Channels

Point-to-Point Channel

EIP reference for Point-to-Point Channel can be found here - http://www.eaipatterns.com/PointToPointChannel.html

val pointToPointChannel = Channel("myDirectChannel")

Publish-Subscribe Channel

EIP reference for Publish-Subscribe Channel can be found here - http://www.eaipatterns.com/PublishSubscribeChannel.html

val publishSubscribeChannel = PubSubChannel("myPubSubChannel")

If you need to add any extra properties to the PubSubChannel you may do so using fluent API available with PubSubChannel. The following is available for PubSubChannel:

PubSubChannel("myPubSubChannel").applyingSequence // will set _sequenceSize_ and _sequenceNumber_ headers

PubSubChannel("myPubSubChannel").withExecutor(Executors.newCachedThreadPool()) // reference to instance of _java.util.concurrent.Executor_

// combination of both
PubSubChannel("myPubSubChannel").applyingSequence.withExecutor(Executors.newCachedThreadPool()) 

Pollable (Queue) Channel

val queueChannel = Channel("myQueueChannel").withQueue

You can also provide capacity and messageStore values for the queue using named parameters

val queueChannel = Channel("myQueueChannel").
                          withQueue(capacity = 2, messageStore = new SimpleMessageStore)

Executor (Async) Channel

Executor channel identified and configured by calling 'withDispatcher' method that takes several named parameters. The following is an example of the full configuration.

val executorChannel = Channel("executorChannel").
                      withDispatcher(failover = false, 
                                     loadBalancer = "round-robin", 
                                     taskExecutor = new SimpleAsyncTaskExecutor)

[Back to Core Messaging Patterns] (https://github.com/SpringSource/spring-integration-dsl-scala/wiki/Core-Messaging-Patterns)