Class FailurePolicy.BuilderBase<BUILDER extends FailurePolicy.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends FailurePolicy>

java.lang.Object
io.helidon.messaging.FailurePolicy.BuilderBase<BUILDER, PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER, PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER, PROTOTYPE>
Direct Known Subclasses:
FailurePolicy.Builder
Enclosing interface:
FailurePolicy

public abstract static class FailurePolicy.BuilderBase<BUILDER extends FailurePolicy.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends FailurePolicy> extends Object implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER, PROTOTYPE>
Fluent API builder base for FailurePolicy.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(FailurePolicy prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(FailurePolicy.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends FailurePolicy.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends FailurePolicy>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • retry

      public BUILDER retry(Retry retry)
      Fault tolerance retry instance used for incoming delivery. When no retry is supplied, all default policies share one messaging retry instance with Integer.MAX_VALUE calls, a one-second initial delay, factor-two exponential backoff, no jitter, a one-minute maximum delay, a practically unbounded timeout, and disabled instance metrics.

      An explicitly configured or programmatically supplied retry is complete and is used as supplied. Options omitted within an explicit retry use fault-tolerance defaults, without inheriting messaging defaults.

      Parameters:
      retry - retry instance
      Returns:
      updated builder instance
      See Also:
    • retry

      public BUILDER retry(RetryConfig retry)
      Fault tolerance retry instance used for incoming delivery. When no retry is supplied, all default policies share one messaging retry instance with Integer.MAX_VALUE calls, a one-second initial delay, factor-two exponential backoff, no jitter, a one-minute maximum delay, a practically unbounded timeout, and disabled instance metrics.

      An explicitly configured or programmatically supplied retry is complete and is used as supplied. Options omitted within an explicit retry use fault-tolerance defaults, without inheriting messaging defaults.

      Parameters:
      retry - prototype of retry instance
      Returns:
      updated builder instance
      See Also:
    • retry

      public BUILDER retry(Consumer<RetryConfig.Builder> consumer)
      Fault tolerance retry instance used for incoming delivery. When no retry is supplied, all default policies share one messaging retry instance with Integer.MAX_VALUE calls, a one-second initial delay, factor-two exponential backoff, no jitter, a one-minute maximum delay, a practically unbounded timeout, and disabled instance metrics.

      An explicitly configured or programmatically supplied retry is complete and is used as supplied. Options omitted within an explicit retry use fault-tolerance defaults, without inheriting messaging defaults.

      Parameters:
      consumer - consumer of builder of retry instance
      Returns:
      updated builder instance
      See Also:
    • retry

      public BUILDER retry(Supplier<? extends Retry> supplier)
      Fault tolerance retry instance used for incoming delivery. When no retry is supplied, all default policies share one messaging retry instance with Integer.MAX_VALUE calls, a one-second initial delay, factor-two exponential backoff, no jitter, a one-minute maximum delay, a practically unbounded timeout, and disabled instance metrics.

      An explicitly configured or programmatically supplied retry is complete and is used as supplied. Options omitted within an explicit retry use fault-tolerance defaults, without inheriting messaging defaults.

      Parameters:
      supplier - supplier of retry instance
      Returns:
      updated builder instance
      See Also:
    • onExhausted

      public BUILDER onExhausted(FailureDisposition onExhausted)
      Terminal disposition after delivery attempts are exhausted; dead letter requires a target channel. A pre-dispatch mapping failure reported through ConnectorDeliveryReservation.startFailed(MessageBatch, RuntimeException) or ConnectorDeliveryReservation.tryStartFailed(MessageBatch, RuntimeException) is always treated as exhausted after its initial attempt because the runtime cannot repeat transport mapping.
      Parameters:
      onExhausted - terminal disposition
      Returns:
      updated builder instance
      See Also:
    • clearDeadLetter

      public BUILDER clearDeadLetter()
      Clear existing value of deadLetter.
      Returns:
      updated builder instance
      See Also:
    • deadLetter

      public BUILDER deadLetter(DeadLetterConfig deadLetter)
      Dead-letter delivery configuration; required for FailureDisposition.DEAD_LETTER and invalid for other dispositions.

      Runtime validation covers the logical channel graph. It cannot detect when distinct connector bindings resolve to the same transport destination, such as two Kafka channels configured with the same topic. A dead-letter target must not resolve back to the source connector.

      Parameters:
      deadLetter - dead-letter configuration
      Returns:
      updated builder instance
      See Also:
    • deadLetter

      public BUILDER deadLetter(Consumer<DeadLetterConfig.Builder> consumer)
      Dead-letter delivery configuration; required for FailureDisposition.DEAD_LETTER and invalid for other dispositions.

      Runtime validation covers the logical channel graph. It cannot detect when distinct connector bindings resolve to the same transport destination, such as two Kafka channels configured with the same topic. A dead-letter target must not resolve back to the source connector.

      Parameters:
      consumer - consumer of builder of dead-letter configuration
      Returns:
      updated builder instance
      See Also:
    • deadLetter

      public BUILDER deadLetter(Supplier<? extends DeadLetterConfig> supplier)
      Dead-letter delivery configuration; required for FailureDisposition.DEAD_LETTER and invalid for other dispositions.

      Runtime validation covers the logical channel graph. It cannot detect when distinct connector bindings resolve to the same transport destination, such as two Kafka channels configured with the same topic. A dead-letter target must not resolve back to the source connector.

      Parameters:
      supplier - supplier of dead-letter configuration
      Returns:
      updated builder instance
      See Also:
    • retry

      public Retry retry()
      Fault tolerance retry instance used for incoming delivery. When no retry is supplied, all default policies share one messaging retry instance with Integer.MAX_VALUE calls, a one-second initial delay, factor-two exponential backoff, no jitter, a one-minute maximum delay, a practically unbounded timeout, and disabled instance metrics.

      An explicitly configured or programmatically supplied retry is complete and is used as supplied. Options omitted within an explicit retry use fault-tolerance defaults, without inheriting messaging defaults.

      Returns:
      retry instance
    • onExhausted

      public FailureDisposition onExhausted()
      Terminal disposition after delivery attempts are exhausted; dead letter requires a target channel. A pre-dispatch mapping failure reported through ConnectorDeliveryReservation.startFailed(MessageBatch, RuntimeException) or ConnectorDeliveryReservation.tryStartFailed(MessageBatch, RuntimeException) is always treated as exhausted after its initial attempt because the runtime cannot repeat transport mapping.
      Returns:
      terminal disposition
    • deadLetter

      public Optional<DeadLetterConfig> deadLetter()
      Dead-letter delivery configuration; required for FailureDisposition.DEAD_LETTER and invalid for other dispositions.

      Runtime validation covers the logical channel graph. It cannot detect when distinct connector bindings resolve to the same transport destination, such as two Kafka channels configured with the same topic. A dead-letter target must not resolve back to the source connector.

      Returns:
      dead-letter configuration
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
    • buildPrototype

      protected final FailurePolicy buildPrototype(FailurePolicy.BuilderBase<?,?> builder)
      Create a new prototype instance from a builder.
      Parameters:
      builder - builder used to create the prototype
      Returns:
      new prototype instance
    • config

      protected Optional<Config> config()
      Configuration used to configure this instance.
      Returns:
      config instance