Interface PreferredVersionProvider

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Experimental @FunctionalInterface public interface PreferredVersionProvider
Provides the version to record for a Workflow.getVersion(String, int, int) call when the version marker is created for the first time.

This provider is called only during non-replay workflow task execution, before the SDK records a version marker for the change ID. It is not called during replay or after a version was already memoized for the same change ID.

  • Method Details

    • getPreferredVersion

      @Nullable VersionPreference getPreferredVersion(@Nonnull PreferredVersionProviderInput input)
      Returns the preferred version for the supplied getVersion call, or null to use the SDK default of maxSupported.

      This method is invoked on the workflow thread. Any exception it throws propagates out of the getVersion call and fails the current workflow task, which will be retried; a provider that always throws will therefore block the workflow.