public abstract class AbstractBrokerMessageHandler extends Object implements MessageHandler, org.springframework.context.SmartLifecycle, org.springframework.context.ApplicationEventPublisherAware
Constructor and Description |
---|
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)
Handles the message if possible.
|
protected abstract void |
handleMessageInternal(Message<?> message) |
boolean |
isAutoStartup() |
boolean |
isRunning() |
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(Collection<String> destinationPrefixes)
public Collection<String> getDestinationPrefixes()
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
setApplicationEventPublisher
in interface org.springframework.context.ApplicationEventPublisherAware
public org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
public void setAutoStartup(boolean autoStartup)
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public int getPhase()
getPhase
in interface org.springframework.context.Phased
public final boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public final void start()
start
in interface org.springframework.context.Lifecycle
protected void startInternal()
public final void stop()
stop
in interface org.springframework.context.Lifecycle
protected void stopInternal()
public final void stop(Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public final void handleMessage(Message<?> message)
MessageHandler
MessageRejectedException
e.g.
in case of a Selective Consumer. When a consumer tries to handle a
message, but fails to do so, a MessageHandlingException
is
thrown. In the last case it is recommended to treat the message as tainted
and go into an error scenario.
When the handling results in a failure of another message being sent
(e.g. a "reply" message), that failure will trigger a
MessageDeliveryException
.
handleMessage
in interface MessageHandler
message
- the message to be handled
reply related to the handling of the messageprotected abstract void handleMessageInternal(Message<?> message)
protected boolean checkDestinationPrefix(String destination)
protected void publishBrokerAvailableEvent()
protected void publishBrokerUnavailableEvent()