SubscribingRequest

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.

Parameters

<M>

the type of the subscribed messages

<C>

the type of the context of messages or io.spine.core.EmptyContext if messages do not have a context

<W>

the type of the message that wraps a message and its context (e.g. io.spine.core.Event); if subscribed message type does not have a context, this parameter is likely to be the same as M

<B>

the type of this request for return type covariance

Inheritors

Functions

Link copied to clipboard
protected Optional<StreamObserver<SubscriptionUpdate>> chain()
Returns an observer of raw SubscriptionUpdates, which will be called in addition to notifying the consumers.
Link copied to clipboard
public B observe(Consumer<M> consumer)
Subscribes the passed consumer to receive messages of the subscribed type.
Link copied to clipboard
Assigns a handler for an error that may occur in the code of one of the consumers.
Link copied to clipboard
public B onStreamingError(ErrorHandler handler)
Assigns a handler for the error reported to onError of the StreamObserver responsible for delivering messages to the consumers.
Link copied to clipboard
public Subscription post()
Creates and posts the subscription request to the server.

Inherited functions

Link copied to clipboard
public B byId(Array<Message> ids)
public B byId(Array<Integer> ids)
public B byId(Iterable<? extends Object> ids)
public B byId(Array<Long> ids)
public B byId(Array<String> ids)
Requests only passed IDs to be included into the result of the request.
Link copied to clipboard
protected final Client client()
Obtains the client instance that will perform the request.
Link copied to clipboard
public CommandRequest command(CommandMessage c)
Creates a builder for customizing command request.
Link copied to clipboard
Assigns a handler for an error occurred on the server-side (such as validation error) in response to posting a request.
Link copied to clipboard
public QueryRequest<S> select<S extends EntityState>(Class<S> type)
Creates a builder for constructing a query for messages of the specified type.
Link copied to clipboard
public SubscriptionRequest<S> subscribeTo<S extends EntityState>(Class<S> type)
Creates a builder for customizing subscription for the passed entity state type.
Link copied to clipboard
public EventSubscriptionRequest<E> subscribeToEvent<E extends EventMessage>(Class<E> type)
Creates a builder for customizing subscription for the passed event type.
Link copied to clipboard
protected final UserId user()
Obtains the ID of the user of the request.
Link copied to clipboard
public B where(Array<CompositeFilter> filter)
public B where(Array<Filter> filter)
Configures the request to return results matching all the passed filters.
Link copied to clipboard
public B withMask(Iterable<String> fieldNames)
public B withMask(Array<String> fieldNames)
Instructs to populate only fields with the passed names in the results of the request.