public abstract class AbstractBrokerMessageHandler extends Object implements MessageHandler, org.springframework.context.SmartLifecycle, org.springframework.context.ApplicationEventPublisherAware
MessageHandler that broker messages to
registered subscribers.| Constructor and Description |
|---|
AbstractBrokerMessageHandler() |
AbstractBrokerMessageHandler(Collection<String> destinationPrefixes) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkDestinationPrefix(String destination) |
org.springframework.context.ApplicationEventPublisher |
getApplicationEventPublisher() |
Collection<String> |
getDestinationPrefixes() |
int |
getPhase() |
void |
handleMessage(Message<?> message)
Handle the given message.
|
protected abstract void |
handleMessageInternal(Message<?> message) |
boolean |
isAutoStartup() |
boolean |
isBrokerAvailable()
Whether the message broker is currently available and able to process messages.
|
boolean |
isRunning()
Check whether this message handler is currently running.
|
protected void |
publishBrokerAvailableEvent() |
protected void |
publishBrokerUnavailableEvent() |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher) |
void |
setAutoStartup(boolean autoStartup) |
void |
start() |
protected void |
startInternal() |
void |
stop() |
void |
stop(Runnable callback) |
protected void |
stopInternal() |
protected final Log logger
public AbstractBrokerMessageHandler()
public AbstractBrokerMessageHandler(Collection<String> destinationPrefixes)
public Collection<String> getDestinationPrefixes()
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
public void setAutoStartup(boolean autoStartup)
public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic int getPhase()
getPhase in interface org.springframework.context.Phasedpublic final boolean isRunning()
Note that even when this message handler is running the
isBrokerAvailable() flag may still independently alternate between
being on and off depending on the concrete sub-class implementation.
isRunning in interface org.springframework.context.Lifecyclepublic boolean isBrokerAvailable()
Note that this is in addition to the isRunning() flag, which
indicates whether this message handler is running. In other words the message
handler must first be running and then the isBrokerAvailable() flag
may still independently alternate between being on and off depending on the
concrete sub-class implementation.
Application components may implement
org.springframework.context.ApplicationListener
to receive notifications when broker becomes available and unavailable.
public final void start()
start in interface org.springframework.context.Lifecycleprotected void startInternal()
public final void stop()
stop in interface org.springframework.context.Lifecycleprotected void stopInternal()
public final void stop(Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic final void handleMessage(Message<?> message)
MessageHandlerhandleMessage in interface MessageHandlermessage - the message to be handledprotected abstract void handleMessageInternal(Message<?> message)
protected boolean checkDestinationPrefix(String destination)
protected void publishBrokerAvailableEvent()
protected void publishBrokerUnavailableEvent()