See: Description
Interface | Description |
---|---|
Callback | Deprecated
since 6.7
|
ContextCallback<C> | Deprecated
since 6.7
|
Messaging |
This feature provides a client session with request-response messaging
capabilities that can be used to implement application services.
|
Messaging.FilteredRequestCallback<R> |
Callback interface for requests dispatched through a filter.
|
Messaging.RequestHandler<T,R> |
Interface which specifies a request handler to receive request
notifications.
|
Messaging.RequestHandler.RequestContext |
Context of the request received.
|
Messaging.RequestHandler.Responder<R> |
Responder interface to dispatch responses to requests.
|
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.
|
Pings |
This feature provides a client session with the ability to test its
connection to the server.
|
Pings.PingCallback | Deprecated
since 6.7
|
Pings.PingContextCallback<C> | Deprecated
since 6.7
|
Pings.PingDetails |
Server response to a ping.
|
RegisteredHandler | Deprecated
since 6.7
|
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 | Deprecated
since 6.7
|
Security.ChangePrincipalContextCallback<C> | Deprecated
since 6.7
|
ServerHandler | Deprecated
since 6.7
|
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 | Deprecated
since 6.7
|
Topics.CompletionContextCallback<C> | Deprecated
since 6.7
|
Topics.FetchRequest<V> |
A parameterised query that can be used to search the topic tree.
|
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.SubscriberStream |
Base subscriber stream interface.
|
Topics.ValueStream<V> |
Stream interface that can be registered to receive subscription and value
events whenever an update is received from the server.
|
TopicTreeHandler | Deprecated
since 6.7
|
TopicUpdate |
This feature provides a client session with the ability to update topics.
|
TopicUpdate.JsonPatchResult | |
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 |
Indicates a cluster operation failed because partition ownership changed
during processing.
|
ClusterRoutingException |
Indicates a cluster operation failed to be routed to a server within the
cluster due to a communication failure, or the server that owns a partition
is not currently known.
|
ErrorReportsException |
Thrown to report one or more
ErrorReport s}. |
ExclusiveUpdaterConflictException | Deprecated
since 6.6
|
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. |
TopicUpdate.FailedPatchException |
Exception thrown to report that applying a JSON Patch failed.
|
TopicUpdate.InvalidPatchException |
Exception thrown to report that a JSON Patch was invalid.
|
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 © 2022 Push Technology Ltd. All Rights Reserved.