org.mactor.brokers
Class AbstractMessageBroker
java.lang.Object
org.mactor.brokers.AbstractMessageBroker
- All Implemented Interfaces:
- MessageBroker
- Direct Known Subclasses:
- HttpMessageBroker, JmsMessageBroker, PollingMessageBrokerTemplate, SoapMessageBroker, TibcoRvMessageBroker
public abstract class AbstractMessageBroker
- extends java.lang.Object
- implements MessageBroker
Abstract class that contains functinally common to most message broker
implementations (such as maintaining subscribers).
- Author:
- Lars Ivar Almli
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.log4j.Logger log
config
protected MessageBrokersConfig.MessageBrokerConfig config
AbstractMessageBroker
public AbstractMessageBroker(MessageBrokersConfig.MessageBrokerConfig config)
terminate
public void terminate()
- Specified by:
terminate
in interface MessageBroker
subscribe
public void subscribe(java.lang.String channel,
MessageSubscriber subscriber,
MessageSelectorCommand messageSelector)
throws MactorException
- Description copied from interface:
MessageBroker
- Subscibe to message from a channel
- Specified by:
subscribe
in interface MessageBroker
- Parameters:
channel
- the channelsubscriber
- the subscriber that will receive the messagesmessageSelector
- the message selector restricts which messages to receive from
the channel
- Throws:
MactorException
- if some problem occures (this will cause the test to fail)
unsubscribe
public void unsubscribe(java.lang.String channel,
MessageSubscriber subscriber)
throws MactorException
- Description copied from interface:
MessageBroker
- Unsubscribe
- Specified by:
unsubscribe
in interface MessageBroker
- Parameters:
channel
- the channelsubscriber
- the subscriber
- Throws:
MactorException
- if some problem occures
raiseOnMessage
protected Message raiseOnMessage(java.lang.String channel,
Message message,
boolean broadcast)
throws MactorException
- This method shold be invoked message broker implementations when message
is received. The method delivers the message to the subscribers of the
channel
- Parameters:
channel
- the channel the message was receviedmessage
- the messagebroadcast
- a flag that indicates if the message should be distributed to
all subscribers that accepts the message, or just the first
(random) subscriber that accepets the message.
- Returns:
- a result message that might be used by message broker
implementation to return a synchrounous result to the source of
the incoming messages.
- Throws:
MactorException
onFirstSubscribe
protected abstract void onFirstSubscribe(java.lang.String channel)
throws MactorException
- Throws:
MactorException
onLastSubscribe
protected abstract void onLastSubscribe(java.lang.String channel)
throws MactorException
- Throws:
MactorException
Copyright © 2008. All Rights Reserved.