public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport implements HeaderChannelRegistry, SmartLifecycle, 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.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).
|
int |
getPhase() |
long |
getReaperDelay() |
boolean |
isAutoStartup() |
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 |
setAutoStartup(boolean autoStartup) |
void |
setPhase(int phase) |
void |
setReaperDelay(long reaperDelay)
Set the reaper delay.
|
void |
setTaskScheduler(TaskScheduler taskScheduler) |
int |
size() |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getComponentType, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, toString
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 setTaskScheduler(TaskScheduler taskScheduler)
setTaskScheduler
in class IntegrationObjectSupport
public final void setPhase(int phase)
public boolean isAutoStartup()
isAutoStartup
in interface SmartLifecycle
public final void setAutoStartup(boolean autoStartup)
public final int size()
size
in interface HeaderChannelRegistry
protected void onInit() throws Exception
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
Exception
- Any exception.public void stop(Runnable callback)
stop
in interface SmartLifecycle
public Object channelToChannelName(Object channel)
HeaderChannelRegistry
MessageChannel
, it is returned unchanged.channelToChannelName
in interface HeaderChannelRegistry
channel
- The channel.public MessageChannel channelNameToChannel(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