@ManagedResource public class WireTap extends java.lang.Object implements org.springframework.messaging.support.ChannelInterceptor, org.springframework.context.Lifecycle, VetoCapableInterceptor, org.springframework.beans.factory.BeanFactoryAware
ChannelInterceptor that publishes a copy of the intercepted message
to a secondary target while still sending the original message to the main channel.| Constructor and Description |
|---|
WireTap(org.springframework.messaging.MessageChannel channel)
Create a new wire tap with no
MessageSelector. |
WireTap(org.springframework.messaging.MessageChannel channel,
MessageSelector selector)
Create a new wire tap with the provided
MessageSelector. |
WireTap(java.lang.String channelName)
Create a new wire tap based on the MessageChannel name and
with no
MessageSelector. |
WireTap(java.lang.String channelName,
MessageSelector selector)
Create a new wire tap with the provided
MessageSelector. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isRunning()
Check whether the wire tap is currently running.
|
org.springframework.messaging.Message<?> |
preSend(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel)
Intercept the Message and, if accepted by the
MessageSelector,
send it to the secondary target. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setTimeout(long timeout)
Specify the timeout value for sending to the intercepting target.
|
boolean |
shouldIntercept(java.lang.String beanName,
ChannelInterceptorAware channel) |
void |
start()
Restart the wire tap if it has been stopped.
|
void |
stop()
Stop the wire tap.
|
public WireTap(org.springframework.messaging.MessageChannel channel)
MessageSelector.channel - the MessageChannel to which intercepted messages will be sentpublic WireTap(org.springframework.messaging.MessageChannel channel,
MessageSelector selector)
MessageSelector.channel - the channel to which intercepted messages will be sentselector - the selector that must accept a message for it to be
sent to the intercepting channelpublic WireTap(java.lang.String channelName)
MessageSelector.channelName - the name of the target MessageChannel
to which intercepted messages will be sentpublic WireTap(java.lang.String channelName,
MessageSelector selector)
MessageSelector.channelName - the name of the target MessageChannel
to which intercepted messages will be sent.selector - the selector that must accept a message for it to be
sent to the intercepting channelpublic void setTimeout(long timeout)
timeout - the timeout in millisecondspublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwareorg.springframework.beans.BeansException@ManagedAttribute public boolean isRunning()
isRunning in interface org.springframework.context.Lifecycle@ManagedOperation public void start()
start in interface org.springframework.context.Lifecycle@ManagedOperation public void stop()
start().stop in interface org.springframework.context.Lifecyclepublic org.springframework.messaging.Message<?> preSend(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel)
MessageSelector,
send it to the secondary target. If this wire tap's MessageSelector is
null, it will accept all messages.preSend in interface org.springframework.messaging.support.ChannelInterceptorpublic boolean shouldIntercept(java.lang.String beanName,
ChannelInterceptorAware channel)
shouldIntercept in interface VetoCapableInterceptorbeanName - The channel name.channel - The channel that is about to be intercepted.