Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.client.api
Interface ClientMessageBus

All Superinterfaces:
MessageBus
All Known Implementing Classes:
ClientMessageBusImpl, LocationAwareClientMessageBus

public interface ClientMessageBus
extends MessageBus

An extended client-specific/in-browser interface of MessageBus, which defines client-specific functionality.

Author:
Mike Brock

Method Summary
 void addLifecycleListener(BusLifecycleListener l)
          Adds the given listener instance to this bus.
 void addTransportErrorHandler(TransportErrorHandler errorHandler)
          Adds a global transport error handler to deal with any errors which arise from communication between the bus and the server.
 void clearProperties()
           
 Set<String> getAllRegisteredSubjects()
          Returns a set of all reject subjects in the bus.
 void init()
          Takes this bus out of the "local only" state, causing it to try and connect with the server (unless remote communication is globally disabled).
 void removeLifecycleListener(BusLifecycleListener l)
          Removes the given listener from this bus.
 void removeTransportErrorHandler(TransportErrorHandler errorHandler)
          Removes the given global transport error handler from this bus.
 void sendLocal(Message message)
          Delivers the given message to all local callbacks that subscribe to its subject.
 void setProperty(String name, String value)
          Sets a property on the bus.
 void stop(boolean sendDisconnectToServer)
          Takes this bus into the "local only" state.
 Subscription subscribeShadow(String subject, MessageCallback callback)
          Declares a new shadow subscription.
 
Methods inherited from interface org.jboss.errai.bus.client.api.messaging.MessageBus
addSubscribeListener, addUnsubscribeListener, attachMonitor, isSubscribed, send, send, sendGlobal, subscribe, subscribeLocal, unsubscribeAll
 

Method Detail

subscribeShadow

Subscription subscribeShadow(String subject,
                             MessageCallback callback)
Declares a new shadow subscription. Shadow subscriptions are specialized services that are responsible for handling the request of remote services when the bus is in a disconnected state.

When a message is sent by an application component to a remote service while the bus is physically disconnected from the server, the bus will consider shadow subscriptions with a matching subject name to deliver the message to.

Shadow subscriptions are considered routable in all bus states except CONNECTING.

Parameters:
subject - the subject name.
callback -
Returns:

addLifecycleListener

void addLifecycleListener(BusLifecycleListener l)
Adds the given listener instance to this bus. The listener will be notified each time the bus transitions to a different lifecycle state.

Parameters:
l - The listener that wants to receive lifecycle notifications. Must not be null. If the same listener is added more than once, it will receive the corresponding number of callbacks upon each lifecycle event.

removeLifecycleListener

void removeLifecycleListener(BusLifecycleListener l)
Removes the given listener from this bus. The listener will no longer receive lifecycle events from this bus.

Parameters:
l - The listener to remove. If the listener was added more than one time, removing it will decrease by one the number of notifications that listener receices for each event. If the listener was not already registered to receive events, this method has no effect.

init

void init()
Takes this bus out of the "local only" state, causing it to try and connect with the server (unless remote communication is globally disabled).

See Also:
BusToolsCli.isRemoteCommunicationEnabled()

stop

void stop(boolean sendDisconnectToServer)
Takes this bus into the "local only" state.

Parameters:
sendDisconnectToServer - if true, the server will be notified that we are breaking the connection. Else, no attempt will be made to notify the server.

getAllRegisteredSubjects

Set<String> getAllRegisteredSubjects()
Returns a set of all reject subjects in the bus.

Returns:
a set of all registered subjects.

addTransportErrorHandler

void addTransportErrorHandler(TransportErrorHandler errorHandler)
Adds a global transport error handler to deal with any errors which arise from communication between the bus and the server.

Parameters:
errorHandler - the error handler to add.

removeTransportErrorHandler

void removeTransportErrorHandler(TransportErrorHandler errorHandler)
Removes the given global transport error handler from this bus. Once removed, the given handler does not receive transport error notifications anymore.

Parameters:
errorHandler - the error handler to remove. This method has no effect if the given handler is null or it was not already registered.

setProperty

void setProperty(String name,
                 String value)
Sets a property on the bus.

Parameters:
name - the property name
value - the property value

clearProperties

void clearProperties()

sendLocal

void sendLocal(Message message)
Delivers the given message to all local callbacks that subscribe to its subject. Does not transmit the message to other buses.

Parameters:
message - The message to deliver to local subscribers.

Errai 3.0.1-SNAPSHOT

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