public interface Gravity
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Gravity.Listener |
| Modifier and Type | Method and Description |
|---|---|
Channel |
findChannelByClientId(java.lang.String clientId)
Find the channel for a specified clientId
|
java.util.List<Channel> |
findConnectedChannelsByUser(java.lang.String name)
Find all channels for an authenticated user name
|
Channel |
findCurrentChannel(java.lang.String destination)
Current channel for the specified destination
|
java.util.List<Channel> |
getConnectedChannels()
Currently connected channels
|
java.util.List<Channel> |
getConnectedChannelsByDestination(java.lang.String destination)
Channels currently connected for a specified destination
|
java.util.Set<java.security.Principal> |
getConnectedUsers()
Currently connected authenticated users
|
java.util.Set<java.security.Principal> |
getConnectedUsersByDestination(java.lang.String destination)
Authenticated users currently connected for a specified destination
|
GraniteConfig |
getGraniteConfig()
Current Granite configuration
|
GravityConfig |
getGravityConfig()
Current Gravity configuration
|
ServicesConfig |
getServicesConfig()
Current services configuration
|
Message |
handleMessage(Message message)
Handle a message using the configured service adapter
|
Message |
handleMessage(Message message,
boolean skipInterceptor)
Handle a message using the configured service adapter, optionally skipping interceptors
|
boolean |
isStarted()
State of the Gravity component
|
Message |
publishMessage(AsyncMessage message)
Publish a message to connected users from the default server channel
|
Message |
publishMessage(Channel fromChannel,
AsyncMessage message)
Publish a message to connected users from the specified user channel
|
void |
reconfigure(GravityConfig gravityConfig,
GraniteConfig graniteConfig)
Update the current configuration and restarts
|
void |
registerListener(Gravity.Listener listener)
Registers a listener which will be notified of channel events (connect/disconnect/subscription/unsubscription)
|
Message |
sendRequest(Channel fromChannel,
AsyncMessage message)
Send a server-to-client request, waiting synchronously for the response
|
void |
start()
Start the Gravity component
|
void |
stop()
Stop the Gravity component
|
void |
stop(boolean now)
Stop the Gravity component, optionally forcing immediate shutdown (without waiting for channel closing)
|
void |
unregisterListener(Gravity.Listener listener)
Unregisters a listener which will be notified of channel events (connect/disconnect/subscription/unsubscription)
|
GravityConfig getGravityConfig()
ServicesConfig getServicesConfig()
GraniteConfig getGraniteConfig()
boolean isStarted()
void start()
throws java.lang.Exception
java.lang.Exceptionvoid reconfigure(GravityConfig gravityConfig, GraniteConfig graniteConfig)
gravityConfig - Gravity configgraniteConfig - Granite configvoid stop()
throws java.lang.Exception
java.lang.Exceptionvoid stop(boolean now)
throws java.lang.Exception
java.lang.Exceptionvoid registerListener(Gravity.Listener listener)
listener - void unregisterListener(Gravity.Listener listener)
listener - java.util.List<Channel> getConnectedChannels()
java.util.Set<java.security.Principal> getConnectedUsers()
java.util.List<Channel> getConnectedChannelsByDestination(java.lang.String destination)
destination - a destinationjava.util.Set<java.security.Principal> getConnectedUsersByDestination(java.lang.String destination)
destination - a destinationjava.util.List<Channel> findConnectedChannelsByUser(java.lang.String name)
name - user nameChannel findChannelByClientId(java.lang.String clientId)
clientId - client idChannel findCurrentChannel(java.lang.String destination)
destination - destinationMessage handleMessage(Message message)
message - messageMessage handleMessage(Message message, boolean skipInterceptor)
message - messageskipInterceptor - skip interceptorsMessage publishMessage(AsyncMessage message)
message - message to publishMessage publishMessage(Channel fromChannel, AsyncMessage message)
fromChannel - originating channelmessage - message to publishMessage sendRequest(Channel fromChannel, AsyncMessage message)
fromChannel - originating channelmessage - request