WorkerResponseImpl extension

Class used to communicate from a Worker to clients. WorkerResponses are used to provide individual results to the client. Future-based services simply return a single WorkerResponse with the result. Streaming services will return one WorkerResponses for each stream item and mmust send a WorkerResponseImpl.closeStream message to indicate completion. WorkerResponses can also send error messages. Extension methods operating on a List as a WorkerResponse. WorkerResponse is used to provide individual results to the client. Future-based services simply return a single WorkerResponse with the result. Stream services return one WorkerResponse for each stream item and mmust send a WorkerResponseImpl.closeStream message to indicate completion. A WorkerResponse can also be used to send error messages.

on

Properties

endOfStream bool
Flag indicating the end of the Streaming operation.
no setter
error SquadronException?
The WorkerResponse exception, if any.
no setter
result → dynamic
Retrieves the result associated to this WorkerResponse. If the WorkerResponse contains an error, an the error exception is thrown.
no setter

Static Methods

closeStream() WorkerResponse
Special WorkerResponse message to indicate the end of a stream.
log(String message) WorkerResponse
WorkerResponse with an error message and an optional (string) StackTrace.
withError(Object exception, [StackTrace? stackTrace]) WorkerResponse
WorkerResponse with an error message and an optional (string) StackTrace.
withResult(dynamic result) WorkerResponse
WorkerResponse with a valid result. If result is an Iterable but not a List, it will be converted to a List by calling toList().