Class NullChannel
java.lang.Object
org.springframework.integration.channel.NullChannel
- All Implemented Interfaces:
Aware
,BeanNameAware
,DisposableBean
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,MessageChannel
,PollableChannel
@IntegrationManagedResource
public class NullChannel
extends Object
implements PollableChannel, BeanNameAware, IntegrationManagement, IntegrationPattern
A channel implementation that essentially behaves like "/dev/null".
All
receive()
calls will return null
,
and all send(org.springframework.messaging.Message<?>, long)
calls will return true
although no action is performed.
Unless the payload of a sent message is a Publisher
implementation, in
which case the Publisher.subscribe(Subscriber)
is called to initiate
the reactive stream, although the data is discarded by this channel.
An error thrown from a reactive stream processing (see Subscriber.onError(Throwable)
)
is logged under the warn
level.
Note however that the invocations are logged at debug-level.- Author:
- Mark Fisher, Gary Russell, Artem Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.messaging.MessageChannel
INDEFINITE_TIMEOUT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Return a pattern type this component implements.Return the overrides.boolean
Return whether logging is enabled.Message<?>
receive()
Message<?>
receive
(long timeout) void
registerMetricsCaptor
(MetricsCaptor registry) Inject aMetricsCaptor
.boolean
boolean
void
setBeanName
(String beanName) void
setLoggingEnabled
(boolean loggingEnabled) Enable logging or not.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getManagedName, getManagedType, getThisAs, setManagedName, setManagedType
-
Constructor Details
-
NullChannel
public NullChannel()
-
-
Method Details
-
setBeanName
- Specified by:
setBeanName
in interfaceBeanNameAware
-
isLoggingEnabled
public boolean isLoggingEnabled()Description copied from interface:IntegrationManagement
Return whether logging is enabled.- Specified by:
isLoggingEnabled
in interfaceIntegrationManagement
- Returns:
- true if enabled.
-
setLoggingEnabled
public void setLoggingEnabled(boolean loggingEnabled) Description copied from interface:IntegrationManagement
Enable logging or not.- Specified by:
setLoggingEnabled
in interfaceIntegrationManagement
- Parameters:
loggingEnabled
- dalse to disable.
-
getBeanName
- Specified by:
getBeanName
in interfaceNamedComponent
-
getComponentName
- Specified by:
getComponentName
in interfaceNamedComponent
-
getComponentType
- Specified by:
getComponentType
in interfaceNamedComponent
-
getIntegrationPatternType
Description copied from interface:IntegrationPattern
Return a pattern type this component implements.- Specified by:
getIntegrationPatternType
in interfaceIntegrationPattern
- Returns:
- the
IntegrationPatternType
this component implements.
-
registerMetricsCaptor
Description copied from interface:IntegrationManagement
Inject aMetricsCaptor
.- Specified by:
registerMetricsCaptor
in interfaceIntegrationManagement
- Parameters:
registry
- the captor.
-
getOverrides
Description copied from interface:IntegrationManagement
Return the overrides.- Specified by:
getOverrides
in interfaceIntegrationManagement
- Returns:
- the overrides.
-
send
- Specified by:
send
in interfaceMessageChannel
-
send
- Specified by:
send
in interfaceMessageChannel
-
receive
- Specified by:
receive
in interfacePollableChannel
-
receive
- Specified by:
receive
in interfacePollableChannel
-
toString
-
destroy
public void destroy()- Specified by:
destroy
in interfaceDisposableBean
- Specified by:
destroy
in interfaceIntegrationManagement
-