See: Description
Interface | Description |
---|---|
Callback |
A callback interface used to return results from a call to the server.
|
ContextCallback<C> |
A callback interface used to return results from a call to the server with
context supplied with the call.
|
ContextStream<C> | Deprecated
since 6.2
|
Messaging |
This feature provides a client session with messaging capabilities.
|
Messaging.MessageStream | Deprecated
since 6.2
|
Messaging.RequestStream<T,R> |
Interface which specifies a request stream to receive request
notifications.
|
Messaging.RequestStream.Responder<R> |
Responder interface to dispatch responses to requests.
|
Messaging.SendCallback | Deprecated
since 6.2
|
Messaging.SendContextCallback<C> | Deprecated
since 6.2
|
Pings |
This feature provides a client session with the ability to test its
connection to the server.
|
Pings.PingCallback |
Callback interface for
Pings.pingServer(PingCallback) . |
Pings.PingContextCallback<C> |
Callback interface for
Pings.pingServer(Object, PingContextCallback) . |
Pings.PingDetails |
Server response to a ping.
|
RegisteredHandler |
A reference to a registered handler.
|
Security |
This feature provides a client session with the ability to change its
associated principal as well as to query permissions assigned to it.
|
Security.ChangePrincipalCallback |
The callback interface for
Security.changePrincipal(String, Credentials, ChangePrincipalCallback)
. |
Security.ChangePrincipalContextCallback<C> |
The callback interface for
Security.changePrincipal(String, Credentials, Object, ChangePrincipalContextCallback)
. |
ServerHandler |
This is the base interface for all callback handlers registered via a client
session that establish a server side control presence for the
client. |
Stream | Deprecated
since 6.2
|
TimeSeries |
This feature allows a session to update and query time series topics.
|
TimeSeries.Event<V> |
An event in a time series.
|
TimeSeries.EventMetadata |
Time series event metadata.
|
TimeSeries.Query<V> |
A configured query.
|
TimeSeries.QueryResult<V> |
Query result providing a
stream of events . |
TimeSeries.RangeQuery<V> |
Builder for queries that select a range of events from a time series.
|
Topics |
This feature allows a client session to subscribe to topics to receive
streamed topic updates, fetch the state of topics and/or update topics with
new values.
|
Topics.CompletionCallback |
Callback interface for success or failure notifications from subscription
and unsubscription operations.
|
Topics.CompletionContextCallback<C> |
Contextual callback interface for success or failure notifications from
subscription operations.
|
Topics.FetchContextStream<C> | Deprecated
since 6.2
|
Topics.FetchRequest<V> |
A fetch request.
|
Topics.FetchResult<V> |
Encapsulates the results from a fetch operation issued to the server.
|
Topics.FetchResult.TopicResult<V> |
Encapsulates the result of a
fetch invocation for a single selected topic. |
Topics.FetchStream | Deprecated
since 6.2
|
Topics.SubscriberStream |
Base subscriber stream interface.
|
Topics.TopicDetailsCallback | Deprecated
since 6.0
|
Topics.TopicDetailsContextCallback<C> | Deprecated
since 6.0
|
Topics.ValueStream<V> |
Stream interface that can be registered to receive subscription and value
events whenever an update is received from the server.
|
TopicTreeHandler |
Common base interface for callback handlers registered via the client
session that establish a server side control presence for a
branch of the topic tree. |
TopicUpdate |
This feature provides a client session with the ability to update topics.
|
UpdateConstraint |
A constraint to be applied to an update operation or the creation of an
update stream.
|
UpdateConstraint.Factory |
Factory for the constraint types.
|
UpdateConstraint.PartialJSON |
A constraint requiring the current value of a
JSON topic to match the partially described
value. |
UpdateStream<T> |
An update stream provides a method for updating a specific topic.
|
Enum | Description |
---|---|
TimeSeries.QueryResult.StreamStructure |
Describes the structural properties of a stream.
|
TopicCreationResult |
Result indicating whether the operation caused a topic to be created or if
it already existed.
|
Topics.UnsubscribeReason |
The reason that an unsubscription occurred.
|
Exception | Description |
---|---|
ClusterRepartitionException |
Thrown to indicate an operation failed because the cluster was migrating
partitions between servers.
|
ErrorReportsException |
Thrown to report one or more
ErrorReport s}. |
ExclusiveUpdaterConflictException |
Thrown to indicate an update could not be applied because an exclusive
update source is registered for the path.
|
HandlerConflictException |
Thrown to indicate a handler could not be registered because it conflicts
with an existing handler.
|
IncompatibleDatatypeException |
Exception used to report that an operation has failed
because the receiver could not process the supplied data.
|
IncompatibleTopicException |
Exception used to report a topic is incompatible with an operation.
|
IncompatibleTopicStateException |
An operation could not be performed because the topic is managed by a
component (such as fan-out) that prohibits updates from the caller.
|
InvalidFilterException |
Exception used to report a filter expression is invalid.
|
InvalidUpdateStreamException |
Exception used to report an operation was performed with an invalid
update stream . |
NoSuchSessionException |
Exception used to report there is no session for a given session ID.
|
NoSuchTopicException |
Exception used to report there is no topic bound to a topic path.
|
RejectedRequestException |
Exception used to report that a recipient session
has rejected a request.
|
ScriptException |
Exception used to report problems evaluating a script.
|
TimeSeries.InvalidQueryException |
Exception used to report a query that is invalid for the time series.
|
TimeSeries.NoSuchEventException |
Exception used to report a time series topic does not have an original
event with the sequence number provided by an
edit operation. |
UnhandledMessageException |
Exception used to report a message was not delivered to an application
handler.
|
UnsatisfiedConstraintException |
Exception used to report that a constraint was not satisfied.
|
UpdateFailedException |
Exception used to report a topic update failed.
|
This package contains the standard client features.
A feature
represents a unit of functionality that is available to use within a client
session
.
Standard client features include:
Topics
This feature allows a client to subscribe to topics in order to receive
streaming updates. It also allows a client to fetch the state of topics
without having to subscribe to them.
Messaging
This feature allows a client to send messages on a topic (to be delivered to
the controller of that topic) or receive messages on topics (send by topic
controllers).
Pings
This feature allows a client to ping the server to ensure connectivity and
to obtain round trip timings.
Security
This feature allows a client to change it's principal.
A feature may be obtained from a session using the
feature
method specifying the feature class. For example:
Topics topics = session.feature(Topics.class);
Since version 6.0, the API has been extended to support Java 8's CompletableFuture. All methods that have a callback that produces a single outcome now have an alternative that returns the outcome using a CompletableFuture rather than a callback.
Some methods have a return type of CompletableFuture<?>
. The result
type is a wildcard rather than Void
to provide forward compatibility
with future iterations of this API that may provide a non-null result with a
more specific result type. If such a method is called and the task completes
successfully, the CompletableFuture result will be null.
Calling a blocking CompletableFuture method, such as
get
or
join
, from a Diffusion
thread is disallowed since doing so can cause the client to deadlock because
the same thread is used to deliver responses from the server to the session.
This situation typically happens when chaining CompletableFutures. To protect
against deadlock, Diffusion detects the use of a blocking method from a
Diffusion thread, and completes the CompletableFuture exceptionally with a
UnsupportedOperationException
. For example:
messaging.sendMessage("x", "m1", String.class, String.class) .thenAccept(r1 -> { // This will run in the Diffusion input thread, when the // result of the first call is received. CompletableFuture<String> cf = messaging.sendMessage("y", r1, String.class, String.class); // This will immediately throw an ExecutionException with an // UnsupportedOperationException cause. String r2 = cf.get(); // Not reached. LOG.info("Result {}", r2); });
To avoid the problem, when calling a second Diffusion method from a handler
attached to a Diffusion-supplied CompletableFuture, only use non-blocking
methods such as
thenAccept
on the result returned by the second method. For example:
messaging.sendMessage("x", "m1", String.class, String.class) .thenAccept(r1 -> { // This will run in the Diffusion input thread, when the // result of the first call is received. CompletableFuture<String> cf = messaging.sendMessage("y", r1, String.class, String.class); cf.thenAccept(r2 -> { LOG.info("Result {}", r2); }); });
The blocking call protection is effective against the use of get
and
join
, but does not work if a CompletableFuture is exposed indirectly
as a stage of a plain, unprotected CompletableFuture via
allOf()
,
anyOf
,
thenCombine
,
acceptEither
, etc.
Copyright © 2019 Push Technology Ltd. All Rights Reserved.