Package org.eclipse.emf.cdo.session.remote

# Interface CDORemoteTopic

All Superinterfaces:
  `Comparable<CDORemoteTopic>`, `org.eclipse.net4j.util.container.IContainer<CDORemoteSession>`, `org.eclipse.net4j.util.event.INotifier`

All Known Subinterfaces:
  `InternalCDORemoteTopic`

public interface CDORemoteTopic extends org.eclipse.net4j.util.container.IContainer<CDORemoteSession>, Comparable<CDORemoteTopic>
A topic to that the `local session` and `remote sessions` can subscribe in order to receive `events` about their `participation` and the `messages` that they send to the topic.

Use the `CDORemoteSessionManager.subscribeTopic()` method to subscribe to a topic and the `CDORemoteTopic.unsubscribe()` method to unsubscribe from it.

Use the `CDORemoteTopic.sendMessage()` method to send a message to all subscribed `remote sessions`.

This fires the following `events` to `registered` listeners:

- `IContainerEvent` with `CDORemoteSession` as generic type argument to reflect subscribed or unsubscribed remote sessions.
- `CDORemoteSessionEvent.MessageReceived` to deliver custom data `sent` from other sessions.

Since:
  4.17
Author:
  Eike Stepper
No Implement
  This interface is not intended to be implemented by clients.
No Extend
  This interface is not intended to be extended by clients.

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer

`org.eclipse.net4j.util.container.IContainer.Modifiable<E extends Object>, org.eclipse.net4j.util.container.IContainer.Persistable<E extends Object>, org.eclipse.net4j.util.container.IContainer.Persistence<E extends Object>`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

`org.eclipse.net4j.util.event.INotifier.INotifier2`

## Method Summary

Modifier and Type
Method
Description
`String`
`getID()`
Returns the `id` that identifies this topic.
`CDORemoteSessionManager`
`getManager()`
Returns the remote session manager that manages this remote topic.
`CDORemoteSession[]`
`getRemoteSessions()`
Returns an array of the `remote sessions` that participate in this topic.
`boolean`
`isSubscribed()`
Returns `false` if the `unsubscribe()` method had been called, `true` otherwise.
`Set<CDORemoteSession>`
`sendMessage(CDORemoteSessionMessage message)`
Sends the given `message` to all subscribed `remote sessions`.
`void`
`unsubscribe()`
Unsubscribes from this topic.

### Methods inherited from interface java.lang.Comparable

`compareTo`

### Methods inherited from interface org.eclipse.net4j.util.container.IContainer

`getElements, isEmpty`

### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

`addListener, getListeners, hasListeners, removeListener`

## Method Details

### getManager

CDORemoteSessionManager getManager()
Returns the remote session manager that manages this remote topic.

### getID

String getID()
Returns the `id` that identifies this topic.

### getRemoteSessions

CDORemoteSession[] getRemoteSessions()
Returns an array of the `remote sessions` that participate in this topic.

### sendMessage

Set<CDORemoteSession> sendMessage(CDORemoteSessionMessage message)
Sends the given `message` to all subscribed `remote sessions`.

Returns:
  The set of `recipients` that the message has been forwarded to by the server. Note: No assumption must be made on whether a recipient session received the message and was able to handle it adequately!

### isSubscribed

boolean isSubscribed()
Returns `false` if the `unsubscribe()` method had been called, `true` otherwise.

### unsubscribe

void unsubscribe()
Unsubscribes from this topic. All further calls to `isSubscribed()` will return `false`.