org.mactor.brokers
Interface MessageBroker

All Known Implementing Classes:
AbstractMessageBroker, FileMessageBroker, HttpMessageBroker, JmsMessageBroker, MqSeriesMessageBroker, PollingMessageBrokerTemplate, SoapMessageBroker, TibcoRvMessageBroker

public interface MessageBroker

Defines the message broker interface

Message broker implementations is not requiered to implement both publish and subscribe (UnsupportedOperationException should be thrown by methods not implemented by the message broker)

Message broker implementations must have contructor that takes a

 MessageBrokerConfig
 
as the single parameter

The simplest way to implement a message broker is to extend the AbstractMessageBroker class, or the PollingMessageBrokerTemplate if the protocol is polling based (i.e. the case for FilesMessageBroker)

Author:
Lars Ivar Almli

Method Summary
 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 subscribe(java.lang.String channel, MessageSubscriber subscriber, MessageSelectorCommand messageSelector)
          Subscibe to message from a channel
 void terminate()
           
 void unsubscribe(java.lang.String channel, MessageSubscriber subscriber)
          Unsubscribe
 

Method Detail

subscribe

void subscribe(java.lang.String channel,
               MessageSubscriber subscriber,
               MessageSelectorCommand messageSelector)
               throws MactorException
Subscibe to message from a channel

Parameters:
channel - the channel
subscriber - the subscriber that will receive the messages
messageSelector - 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

void unsubscribe(java.lang.String channel,
                 MessageSubscriber subscriber)
                 throws MactorException
Unsubscribe

Parameters:
channel - the channel
subscriber - the subscriber
Throws:
MactorException - if some problem occures

publish

void publish(java.lang.String channel,
             Message message)
             throws MactorException
Publish a message to a channel

Parameters:
channel - the channel
message - the message
Throws:
MactorException - if some problem occures (this will cause the test to fail)

publishWithResponse

Message publishWithResponse(java.lang.String channel,
                            Message message)
                            throws MactorException
Publish a message and expect a reponse (when dealing with synchrounous protcols)

Parameters:
channel - the channel
message - the message
Returns:
the response message
Throws:
MactorException - if some problem occures (this will cause the test to fail)

terminate

void terminate()


Copyright © 2008. All Rights Reserved.