Spring Integration

org.springframework.integration.channel.registry
Class LocalChannelRegistry

java.lang.Object
  extended by org.springframework.integration.channel.registry.LocalChannelRegistry
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, ChannelRegistry

public class LocalChannelRegistry
extends java.lang.Object
implements ChannelRegistry, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean

A simple implementation of ChannelRegistry for in-process use. For inbound and outbound, creates a DirectChannel and bridges the passed MessageChannel to the channel which is registered in the given application context. If that channel does not yet exist, it will be created. For tap, it adds a WireTap for an inbound channel whose name matches the one provided. If no such inbound channel exists at the time of the method invocation, it will throw an Exception. Otherwise the provided channel instance will receive messages from the wire tap on that inbound channel.

Since:
3.0
Author:
David Turanski, Mark Fisher

Constructor Summary
LocalChannelRegistry()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  BridgeHandler bridge(SubscribableChannel from, MessageChannel to)
           
protected
<T extends AbstractMessageChannel>
T
createSharedChannel(java.lang.String name, java.lang.Class<T> requiredType)
           
 void inbound(java.lang.String name, MessageChannel channel)
          Looks up or creates a DirectChannel with the given name and creates a bridge from that channel to the provided channel instance.
protected
<T extends AbstractMessageChannel>
T
lookupOrCreateSharedChannel(java.lang.String name, java.lang.Class<T> requiredType)
           
 void outbound(java.lang.String name, MessageChannel channel)
          Looks up or creates a DirectChannel with the given name and creates a bridge to that channel from the provided channel instance.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void tap(java.lang.String name, MessageChannel channel)
          Looks up a wiretap for the inbound channel with the given name and creates a bridge from that wiretap's output channel to the provided channel instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalChannelRegistry

public LocalChannelRegistry()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

inbound

public void inbound(java.lang.String name,
                    MessageChannel channel)
Looks up or creates a DirectChannel with the given name and creates a bridge from that channel to the provided channel instance. Also registers a wire tap if the channel for the given name had been created. The target of the wire tap is a publish-subscribe channel.

Specified by:
inbound in interface ChannelRegistry
Parameters:
name - the logical identity of the message source
channel - the channel bound as a consumer

outbound

public void outbound(java.lang.String name,
                     MessageChannel channel)
Looks up or creates a DirectChannel with the given name and creates a bridge to that channel from the provided channel instance.

Specified by:
outbound in interface ChannelRegistry
Parameters:
name - the logical identity of the message target
channel - the channel bound as a producer

tap

public void tap(java.lang.String name,
                MessageChannel channel)
Looks up a wiretap for the inbound channel with the given name and creates a bridge from that wiretap's output channel to the provided channel instance. Will throw an Exception if no such wiretap exists.

Specified by:
tap in interface ChannelRegistry
Parameters:
name - the registered name
channel - the channel that will receive messages from the tap

lookupOrCreateSharedChannel

protected <T extends AbstractMessageChannel> T lookupOrCreateSharedChannel(java.lang.String name,
                                                                           java.lang.Class<T> requiredType)

createSharedChannel

protected <T extends AbstractMessageChannel> T createSharedChannel(java.lang.String name,
                                                                   java.lang.Class<T> requiredType)

bridge

protected BridgeHandler bridge(SubscribableChannel from,
                               MessageChannel to)

Spring Integration