Interface PreparedLocalDispatch
DispatchInterceptor to local dispatch without requiring Fluxzero to create a complete message
before handler selection.
A prepared policy is created for one LocalDispatchDescriptor, may be cached, and may be invoked
concurrently. Implementations must therefore be immutable or otherwise thread-safe. Data belonging to one dispatch
is available through the supplied LocalExecution.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PreparedLocalDispatchA policy that leaves every local dispatch unchanged. -
Method Summary
Modifier and TypeMethodDescriptiondefault MetadatainterceptMetadata(Metadata metadata, LocalExecution execution) Applies this interceptor's metadata changes when metadata is first requested for the local message.default booleanprepare(LocalExecution execution) Performs work that must happen before Fluxzero selects a local handler.default booleanReturns whetherprepare(LocalExecution)performs per-dispatch work.
-
Field Details
-
noOp
A policy that leaves every local dispatch unchanged.
-
-
Method Details
-
prepare
Performs work that must happen before Fluxzero selects a local handler.This method runs once for each dispatch. Returning
falseabandons prepared local handling and makes the caller use the regular message-based dispatch path. It must not suppress a message; suppression remains part of the regularDispatchInterceptor.interceptDispatch(io.fluxzero.sdk.common.Message, io.fluxzero.common.MessageType, String)contract.- Parameters:
execution- the current local dispatch- Returns:
trueto continue prepared local handling, orfalseto use the regular dispatch path
-
requiresPreparation
default boolean requiresPreparation()Returns whetherprepare(LocalExecution)performs per-dispatch work.Return
falseonly when callingpreparecan always be skipped safely. The default is conservative and returnstrue.- Returns:
trueif preparation must run before local handler selection
-
interceptMetadata
Applies this interceptor's metadata changes when metadata is first requested for the local message.This method may run later than
prepare(LocalExecution), or not at all when neither the handler nor another interceptor observes metadata. Its result must match the metadata produced by regular dispatch.- Parameters:
metadata- the metadata produced by earlier prepared dispatch policiesexecution- the current local dispatch- Returns:
- the metadata to pass to later policies and the handler
-