Interface PreparedLocalDispatch


public interface PreparedLocalDispatch
Applies a 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 Details

  • Method Details

    • prepare

      default boolean prepare(LocalExecution execution)
      Performs work that must happen before Fluxzero selects a local handler.

      This method runs once for each dispatch. Returning false abandons 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 regular DispatchInterceptor.interceptDispatch(io.fluxzero.sdk.common.Message, io.fluxzero.common.MessageType, String) contract.

      Parameters:
      execution - the current local dispatch
      Returns:
      true to continue prepared local handling, or false to use the regular dispatch path
    • requiresPreparation

      default boolean requiresPreparation()
      Returns whether prepare(LocalExecution) performs per-dispatch work.

      Return false only when calling prepare can always be skipped safely. The default is conservative and returns true.

      Returns:
      true if preparation must run before local handler selection
    • interceptMetadata

      default Metadata interceptMetadata(Metadata metadata, LocalExecution execution)
      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 policies
      execution - the current local dispatch
      Returns:
      the metadata to pass to later policies and the handler