public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport implements HeaderChannelRegistry, ManageableLifecycle, Runnable
BeanFactoryChannelResolver
to find the channel by name
in the event that the flow serialized the message at some point.
Channels are expired after a configurable delay (60 seconds by default).
The actual average expiry time will be 1.5x the delay.Modifier and Type | Field and Description |
---|---|
protected Map<String,org.springframework.integration.channel.DefaultHeaderChannelRegistry.MessageChannelWrapper> |
channels |
protected static AtomicLong |
id |
protected String |
uuid |
EXPRESSION_PARSER, logger
Constructor and Description |
---|
DefaultHeaderChannelRegistry()
Constructs a registry with the default delay for channel expiry.
|
DefaultHeaderChannelRegistry(long reaperDelay)
Constructs a registry with the provided delay (milliseconds) for
channel expiry.
|
Modifier and Type | Method and Description |
---|---|
MessageChannel |
channelNameToChannel(String name)
Converts the channel name back to a
MessageChannel (if it is
registered). |
Object |
channelToChannelName(Object channel)
Converts the channel to a name (String).
|
Object |
channelToChannelName(Object channel,
long timeToLive)
Converts the channel to a name (String).
|
long |
getReaperDelay() |
boolean |
isRunning() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
run() |
void |
runReaper()
Cancel the scheduled reap task and run immediately; then reschedule.
|
void |
setReaperDelay(long reaperDelay)
Set the reaper delay.
|
void |
setRemoveOnGet(boolean removeOnGet)
Set to true to immediately remove the channel mapping when
channelNameToChannel(String) is invoked. |
int |
size() |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
protected static final AtomicLong id
protected final Map<String,org.springframework.integration.channel.DefaultHeaderChannelRegistry.MessageChannelWrapper> channels
protected final String uuid
public DefaultHeaderChannelRegistry()
public DefaultHeaderChannelRegistry(long reaperDelay)
reaperDelay
- the delay in milliseconds.public final void setReaperDelay(long reaperDelay)
reaperDelay
- the delay in milliseconds.public final long getReaperDelay()
public void setRemoveOnGet(boolean removeOnGet)
channelNameToChannel(String)
is invoked.removeOnGet
- true to remove immediately, default false.public final int size()
size
in interface HeaderChannelRegistry
protected void onInit()
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
public void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
public void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
public void stop(Runnable callback)
public boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle
@Nullable public Object channelToChannelName(@Nullable Object channel)
HeaderChannelRegistry
MessageChannel
, it is returned unchanged.channelToChannelName
in interface HeaderChannelRegistry
channel
- The channel.@Nullable public Object channelToChannelName(@Nullable Object channel, long timeToLive)
HeaderChannelRegistry
MessageChannel
, it is returned unchanged.channelToChannelName
in interface HeaderChannelRegistry
channel
- The channel.timeToLive
- How long (ms) at a minimum, the channel mapping should
remain in the registry.@Nullable public MessageChannel channelNameToChannel(@Nullable String name)
HeaderChannelRegistry
MessageChannel
(if it is
registered).channelNameToChannel
in interface HeaderChannelRegistry
name
- The name of the channel.public void runReaper()
runReaper
in interface HeaderChannelRegistry