Package io.spine.client

This package provides classes and interfaces for performing client requests like posting commands, running queries, or creating subscriptions.

The term actor used in this API means the user on behalf of whom requests are created and executed. The package provides two levels of API.

High-level io.spine.client.Client API
is meant for client-side Java applications that would communicate with backend services via a gRPC connection. An instance of the io.spine.client.Client class establishes this connection and serves as a fluent API gateway for composing and posting requests.
Low-level io.spine.client.ActorRequestFactory API
is meant for server-side code which needs to speak to backend services without involving gRPC. This API is also by the High-level API implementation.

The io.spine.client.Filters utility class provides methods for composing filtering conditions for both levels of the API.

When subscribing the Client API accepts an implementation of a functional interface (see io.spine.client.StateConsumer and io.spine.client.EventConsumer). Errors occurred when streaming or consuming messages are handled via io.spine.client.ErrorHandler and io.spine.client.ConsumerErrorHandler correspondingly.

Types

Link copied to clipboard
public class ActorRequestFactory
A factory for various requests fired from the client-side by an actor.
Link copied to clipboard
public class Client implements AutoCloseable
The gRPC-based gateway for backend services such as CommandService, QueryService, or SubscriptionService.
Link copied to clipboard
public class ClientRequest
Entry point for creating client requests.
Link copied to clipboard
public final class CommandFactory
A factory of Command instances.
Link copied to clipboard
public final class CommandRequest extends ClientRequest
Allows to post a command optionally subscribing to events that are immediate results of handling this command.
Link copied to clipboard
public final class CompositeEntityStateFilter extends TypedCompositeFilter<M>
A subscription filter which aggregates one or more EntityState filters.
Link copied to clipboard
public final class CompositeEventFilter extends TypedCompositeFilter<M>
A composite subscription filter which can aggregate both event message and event context filters.
Link copied to clipboard
public final class CompositeQueryFilter extends TypedCompositeFilter<M>
A composite query filter which targets one or more entity columns.
Link copied to clipboard
public final class ConnectionConstants
Constant values shared between the client and the server code.
Link copied to clipboard
public interface ConsumerErrorHandler<M extends Message> implements BiConsumer<T, U>
Functional interface for handlers of errors caused by consumers of messages.
Link copied to clipboard
public final class EntityStateFilter extends TypedFilter<M>
A subscription filter which targets an EntityState.
Link copied to clipboard
public interface ErrorHandler implements Consumer<T>
Functional interface for error handlers.
Link copied to clipboard
public interface EventConsumer<E extends EventMessage> implements MessageConsumer<M, C>
Represents an operation which accepts an event message and its context.
Link copied to clipboard
public final class EventFilter extends TypedFilter<M>
A subscription filter which targets an Event.
Link copied to clipboard
public interface EventObserver<E extends EventMessage> implements EventConsumer<E>
Adapts gRPC streaming API to EventConsumer by passing the received Event to the accept method.
Link copied to clipboard
public final class EventSubscriptionRequest<E extends EventMessage> extends SubscribingRequest<M, C, W, B>
Allows to subscribe to events using filtering conditions.
Link copied to clipboard
public abstract class FilteringRequest<M extends Message, R extends Message, A extends TargetBuilder<R, A>, B extends FilteringRequest<M, R, A, B>> extends ClientRequest
Abstract base for client requests that may filter messages by certain criteria.
Link copied to clipboard
public final class Filters
A factory of Filter instances.
Link copied to clipboard
public enum OperatorEvaluator
A boolean non-typed comparison operation on two given instances.
Link copied to clipboard
public final class QueryBuilder extends TargetBuilder<T, B>
A builder for the Query instances.
Link copied to clipboard
public final class QueryFactory
A factory of Query instances.
Link copied to clipboard
public final class QueryFilter extends TypedFilter<M>
A query filter which targets a column of an entity.
Link copied to clipboard
public interface QueryMixin
Useful methods for Query.
Link copied to clipboard
public final class QueryRequest<S extends EntityState> extends FilteringRequest<M, R, A, B>
Allows to create a post a query for messages of the given type.
Link copied to clipboard
public interface ServerErrorHandler implements BiConsumer<T, U>
A handler for an error occurred when posting a message for asynchronous processing at the server side.
Link copied to clipboard
public interface StateConsumer<S extends EntityState> implements Consumer<T>, MessageConsumer<M, C>
Represents an operation that accepts a state of an entity.
Link copied to clipboard
public abstract class SubscribingRequest<M extends Message, C extends MessageContext, W extends Message, B extends SubscribingRequest<M, C, W, B>> extends FilteringRequest<M, R, A, B>
Abstract base for client requests that subscribe to messages.
Link copied to clipboard
public interface SubscriptionMixin
Useful methods for Subscription.
Link copied to clipboard
public final class SubscriptionRequest<S extends EntityState> extends SubscribingRequest<M, C, W, B>
Allows to subscribe to updates of entity states using filtering conditions.
Link copied to clipboard
public final class Subscriptions
Maintains the list of the active subscriptions created by the Client.
Link copied to clipboard
public abstract class TargetBuilder<T extends Message, B extends TargetBuilder<T, B>>
An abstract base for builders that create Message instances which have a Target and a FieldMask as attributes.
Link copied to clipboard
public final class Targets
Client-side utilities for working with Query and Topic targets.
Link copied to clipboard
public final class TopicBuilder extends TargetBuilder<T, B>
A builder for the Topic instances.
Link copied to clipboard
public final class TopicFactory
A factory of Topic instances.