Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.server.service
Class MessageBusProxy

java.lang.Object
  extended by org.jboss.errai.bus.server.service.MessageBusProxy
All Implemented Interfaces:
MessageBus, ServerMessageBus

public class MessageBusProxy
extends Object
implements ServerMessageBus

Author:
Mike Brock

Constructor Summary
MessageBusProxy()
           
 
Method Summary
 void addQueueClosedListener(QueueClosedListener listener)
          Register a QueueClosedListener with the bus.
 void addSubscribeListener(SubscribeListener listener)
          Registers a subscription listener, which is fired whenever a new subscription is created.
 void addUnsubscribeListener(UnsubscribeListener listener)
          Registers an un-subscribe listener, which is fired whenever a subscription is cancelled.
 void associateNewQueue(QueueSession oldSession, QueueSession newSession)
           
 void attachMonitor(BusMonitor monitor)
          Attach a monitor to the bus.
 void closeProxy(ServerMessageBus bus)
           
 void closeQueue(MessageQueue queue)
          Closes the specified message queue
 void closeQueue(String sessionId)
          Closes the queue associated with the sessionId
 void configure(ErraiServiceConfigurator service)
          Configures the bus using the configuration specified
 Message getDeadLetterMessage(String messageId)
           
 Map<QueueSession,MessageQueue> getMessageQueues()
           
 MessageQueue getQueue(QueueSession session)
          Gets the queue containing the messages that are waiting to be transmitted
 MessageQueue getQueueBySession(String id)
           
 Collection<MessageCallback> getReceivers(String subject)
          Get a collection of all receivers registered for a specificed subject
 ExecutorService getScheduler()
          Returns the associated scheduler which keeps track of timed events
 QueueSession getSessionBySessionId(String id)
           
 boolean hasRemoteSubscription(String sessionId, String subject)
           
 boolean hasRemoteSubscriptions(String subject)
           
 boolean isSubscribed(String subject)
          Returns true if there the specified subject has one or more listeners registered.
 boolean removeDeadLetterMessage(String messageId)
           
 void send(Message message)
          Transmits a message.
 void send(Message message, boolean fireListeners)
          Transmits a message and may optionally supress message listeners from firing.
 void sendGlobal(Message message)
          Transmits the message to all directly-peered buses (global in relation to this bus only).
 void stop()
          Stop the MessateBus.
 Subscription subscribe(String subject, MessageCallback receiver)
          Subscribe a listener to the specified subject.
 Subscription subscribeLocal(String subject, MessageCallback receiver)
          Subscribe a listern locally, but do not advertise or make available the service to remote buses.
 void unsubscribeAll(String subject)
          Unsubscribe all listeners registered for the specified subject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageBusProxy

public MessageBusProxy()
Method Detail

sendGlobal

public void sendGlobal(Message message)
Description copied from interface: MessageBus
Transmits the message to all directly-peered buses (global in relation to this bus only).

Specified by:
sendGlobal in interface MessageBus
Parameters:
message - - The message to be sent.

send

public void send(Message message)
Description copied from interface: MessageBus
Transmits a message.

Specified by:
send in interface MessageBus

send

public void send(Message message,
                 boolean fireListeners)
Description copied from interface: MessageBus
Transmits a message and may optionally supress message listeners from firing. This is useful if you are modifying a message from within a listener itself, and wish to retransmit the message.

Specified by:
send in interface MessageBus

subscribe

public Subscription subscribe(String subject,
                              MessageCallback receiver)
Description copied from interface: MessageBus
Subscribe a listener to the specified subject.

Specified by:
subscribe in interface MessageBus

subscribeLocal

public Subscription subscribeLocal(String subject,
                                   MessageCallback receiver)
Description copied from interface: MessageBus
Subscribe a listern locally, but do not advertise or make available the service to remote buses.

Specified by:
subscribeLocal in interface MessageBus

unsubscribeAll

public void unsubscribeAll(String subject)
Description copied from interface: MessageBus
Unsubscribe all listeners registered for the specified subject.

Specified by:
unsubscribeAll in interface MessageBus

isSubscribed

public boolean isSubscribed(String subject)
Description copied from interface: MessageBus
Returns true if there the specified subject has one or more listeners registered.

Specified by:
isSubscribed in interface MessageBus
Returns:

addSubscribeListener

public void addSubscribeListener(SubscribeListener listener)
Description copied from interface: MessageBus
Registers a subscription listener, which is fired whenever a new subscription is created.

Specified by:
addSubscribeListener in interface MessageBus

addUnsubscribeListener

public void addUnsubscribeListener(UnsubscribeListener listener)
Description copied from interface: MessageBus
Registers an un-subscribe listener, which is fired whenever a subscription is cancelled.

Specified by:
addUnsubscribeListener in interface MessageBus

getQueue

public MessageQueue getQueue(QueueSession session)
Description copied from interface: ServerMessageBus
Gets the queue containing the messages that are waiting to be transmitted

Specified by:
getQueue in interface ServerMessageBus
Parameters:
session - - the session of the queue
Returns:
the message queue needed

closeQueue

public void closeQueue(String sessionId)
Description copied from interface: ServerMessageBus
Closes the queue associated with the sessionId

Specified by:
closeQueue in interface ServerMessageBus
Parameters:
sessionId - - the session id of the message queue

closeQueue

public void closeQueue(MessageQueue queue)
Description copied from interface: ServerMessageBus
Closes the specified message queue

Specified by:
closeQueue in interface ServerMessageBus
Parameters:
queue - - the message queue to close

getScheduler

public ExecutorService getScheduler()
Description copied from interface: ServerMessageBus
Returns the associated scheduler which keeps track of timed events

Specified by:
getScheduler in interface ServerMessageBus
Returns:
the Scheduler associated with this bus

addQueueClosedListener

public void addQueueClosedListener(QueueClosedListener listener)
Description copied from interface: ServerMessageBus
Register a QueueClosedListener with the bus.

Specified by:
addQueueClosedListener in interface ServerMessageBus
Parameters:
listener - a instance of the listener

configure

public void configure(ErraiServiceConfigurator service)
Description copied from interface: ServerMessageBus
Configures the bus using the configuration specified

Specified by:
configure in interface ServerMessageBus
Parameters:
service - - the configuration to use

getReceivers

public Collection<MessageCallback> getReceivers(String subject)
Description copied from interface: ServerMessageBus
Get a collection of all receivers registered for a specificed subject

Specified by:
getReceivers in interface ServerMessageBus
Parameters:
subject - The subject.
Returns:

hasRemoteSubscriptions

public boolean hasRemoteSubscriptions(String subject)
Specified by:
hasRemoteSubscriptions in interface ServerMessageBus

hasRemoteSubscription

public boolean hasRemoteSubscription(String sessionId,
                                     String subject)
Specified by:
hasRemoteSubscription in interface ServerMessageBus

getMessageQueues

public Map<QueueSession,MessageQueue> getMessageQueues()
Specified by:
getMessageQueues in interface ServerMessageBus

getQueueBySession

public MessageQueue getQueueBySession(String id)
Specified by:
getQueueBySession in interface ServerMessageBus

getSessionBySessionId

public QueueSession getSessionBySessionId(String id)
Specified by:
getSessionBySessionId in interface ServerMessageBus

associateNewQueue

public void associateNewQueue(QueueSession oldSession,
                              QueueSession newSession)
Specified by:
associateNewQueue in interface ServerMessageBus

stop

public void stop()
Description copied from interface: ServerMessageBus
Stop the MessateBus.

Specified by:
stop in interface ServerMessageBus

getDeadLetterMessage

public Message getDeadLetterMessage(String messageId)
Specified by:
getDeadLetterMessage in interface ServerMessageBus

removeDeadLetterMessage

public boolean removeDeadLetterMessage(String messageId)
Specified by:
removeDeadLetterMessage in interface ServerMessageBus

attachMonitor

public void attachMonitor(BusMonitor monitor)
Description copied from interface: MessageBus
Attach a monitor to the bus.

Specified by:
attachMonitor in interface MessageBus

closeProxy

public void closeProxy(ServerMessageBus bus)

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.