org.mactor.brokers
Class PollingMessageBrokerTemplate
java.lang.Object
org.mactor.brokers.AbstractMessageBroker
org.mactor.brokers.PollingMessageBrokerTemplate
- All Implemented Interfaces:
- MessageBroker
- Direct Known Subclasses:
- FileMessageBroker, MqSeriesMessageBroker
public abstract class PollingMessageBrokerTemplate
- extends AbstractMessageBroker
A template for implementing message brokers for polling bases protocols (i.e.
such as file system polling)
- Author:
- Lars Ivar Almli
- See Also:
FileMessageBroker
Field Summary |
protected static org.apache.log4j.Logger |
log
|
Method Summary |
protected abstract java.util.List<Message> |
doGetMessages(java.lang.String channel,
int maxMessageCount)
Template method called to check for incoming messages (the polling
interval is defined by the message broker config) |
protected abstract void |
doPublishMessage(java.lang.String channel,
Message message)
Template method called to publish a message. |
protected void |
onFirstSubscribe(java.lang.String channel)
|
protected void |
onLastSubscribe(java.lang.String channel)
|
void |
publish(java.lang.String channel,
Message message)
Publish a message to a channel |
Message |
publishWithResponse(java.lang.String channel,
Message message)
Publish a message and expect a reponse (when dealing with synchrounous
protcols) |
void |
terminate()
|
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
PollingMessageBrokerTemplate
public PollingMessageBrokerTemplate(MessageBrokersConfig.MessageBrokerConfig config)
publishWithResponse
public Message publishWithResponse(java.lang.String channel,
Message message)
throws MactorException
- Description copied from interface:
MessageBroker
- Publish a message and expect a reponse (when dealing with synchrounous
protcols)
- Parameters:
channel
- the channelmessage
- the message
- Returns:
- the response message
- Throws:
MactorException
- if some problem occures (this will cause the test to fail)
publish
public void publish(java.lang.String channel,
Message message)
throws MactorException
- Description copied from interface:
MessageBroker
- Publish a message to a channel
- Parameters:
channel
- the channelmessage
- the message
- Throws:
MactorException
- if some problem occures (this will cause the test to fail)
terminate
public void terminate()
- Specified by:
terminate
in interface MessageBroker
- Overrides:
terminate
in class AbstractMessageBroker
doGetMessages
protected abstract java.util.List<Message> doGetMessages(java.lang.String channel,
int maxMessageCount)
throws MactorException
- Template method called to check for incoming messages (the polling
interval is defined by the message broker config)
- Parameters:
channel
- the channelmaxMessageCount
- the max number of messages to return (as defined in the
message broker config).
- Returns:
- list of messages
- Throws:
MactorException
- if a problem occured (this will not cause the test to fail)
doPublishMessage
protected abstract void doPublishMessage(java.lang.String channel,
Message message)
throws MactorException
- Template method called to publish a message.
- Parameters:
channel
- the channelmessage
- the message
- Throws:
MactorException
- if a problem occured (this will cause the test to fail)
onFirstSubscribe
protected void onFirstSubscribe(java.lang.String channel)
- Specified by:
onFirstSubscribe
in class AbstractMessageBroker
onLastSubscribe
protected void onLastSubscribe(java.lang.String channel)
throws MactorException
- Specified by:
onLastSubscribe
in class AbstractMessageBroker
- Throws:
MactorException
Copyright © 2008. All Rights Reserved.