public interface Subscriber extends DispatchableEntity<SubscriberEvent.Type,SubscriberEvent>
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this subscriber to further interaction.
|
void |
connect()
In direct access mode establishes a connection to server data gateway and logs in.
|
void |
disconnect() |
SubscriberEvent |
getNextEvent()
Retrieves the next event from the connection.
|
SubscriberOptions |
getOptions() |
Project |
getProject() |
Stream[] |
getSubscribedStreams()
Returns (possible empty) array of streams currently subscribed to.
|
boolean |
isClosed() |
void |
subscribeSql(java.lang.String sql)
Starts a projection subscription.
|
void |
subscribeStream(Stream stream)
Subscribe to a single stream.
|
void |
subscribeStream(java.lang.String streamName)
Subscribe to a single stream.
|
void |
subscribeStreams(Stream[] streams)
Subscribes to streams.
|
void |
subscribeStreams(java.lang.String[] streamNames)
Subscribes to multiple streams.
|
void |
unsubscribeStream(Stream stream)
Unsubscribes a stream from an active subscription.
|
void |
unsubscribeStream(java.lang.String stream)
Unsubscribes a stream from an active subscription.
|
deregisterSelection, dispatch, removeCallback, selectWith, setCallback, updatevoid connect()
throws java.io.IOException,
javax.security.auth.login.LoginException
java.io.IOExceptionjavax.security.auth.login.LoginExceptionvoid disconnect()
throws java.io.IOException
java.io.IOExceptionvoid close()
throws java.io.IOException
java.io.IOExceptionboolean isClosed()
void subscribeStream(java.lang.String streamName)
throws java.io.IOException
streamName - java.io.IOExceptionvoid subscribeStreams(java.lang.String[] streamNames)
throws java.io.IOException
streamNames - java.io.IOExceptionvoid subscribeStream(Stream stream) throws java.io.IOException
stream - java.io.IOExceptionvoid subscribeStreams(Stream[] streams) throws java.io.IOException
In CALLBACK_ACCESS mode, the call returns immediately. A SubscriberEvent.Type.SUBSCRIBED event is generated for each stream that has been subscribed to.
It is illegal to mix regular and sql subscriptions. If a stream is specified for a Subscriber that already has a sql statement an exception will be generated.
streams - streams to subscribe tojava.io.IOExceptionvoid subscribeSql(java.lang.String sql)
throws java.io.IOException
In callback access the call returns immediately and a SubscriberEvent.Type.SUBSCRIBED event is generated once the subscription is established. If there is an error when subscribing an exception will be thrown in direct access mode. In CALLBACK or SELECT access the error will be trapped when the internal thread actually makes the subscription. All registered event handlers will get a ERROR event.
It is illegal to mix regular and sql subscriptions. If a sql statement is specified for a Subscriber that has already a stream to subscribe an exception will be generated.
sql - the sql statement to run on the platform.java.io.IOExceptionvoid unsubscribeStream(Stream stream) throws java.io.IOException
stream - java.io.IOExceptionvoid unsubscribeStream(java.lang.String stream)
throws java.io.IOException
stream - java.io.IOExceptionSubscriberEvent getNextEvent() throws java.io.IOException
java.io.IOExceptionStream[] getSubscribedStreams()
SubscriberOptions getOptions()