Class ProcessingInstructionUtils

java.lang.Object
org.axonframework.axonserver.connector.util.ProcessingInstructionUtils

public final class ProcessingInstructionUtils extends Object
Utility class contain helper methods to extract information from ProcessingInstructions.
Since:
4.0
Author:
Marc Gathier
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    axonServerSupportsQueryStreaming(List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
    Retrieve whether Axon Server supports streaming from the given instructions, by searching for the value of ProcessingKey.SERVER_SUPPORTS_STREAMING.
    static boolean
    clientSupportsQueryStreaming(List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
    Retrieve whether Client (query issuer) supports streaming from the given instructions, by searching for the value of ProcessingKey.CLIENT_SUPPORTS_STREAMING.
    static io.axoniq.axonserver.grpc.ProcessingInstruction.Builder
    createProcessingInstruction(io.axoniq.axonserver.grpc.ProcessingKey key, boolean value)
    Creates a new ProcessingInstruction.Builder with the given key and value.
    static io.axoniq.axonserver.grpc.ProcessingInstruction.Builder
    createProcessingInstruction(io.axoniq.axonserver.grpc.ProcessingKey key, long value)
    Creates a new ProcessingInstruction.Builder with the given key and value.
    static io.axoniq.axonserver.grpc.ProcessingInstruction.Builder
    createProcessingInstruction(io.axoniq.axonserver.grpc.ProcessingKey key, io.axoniq.axonserver.grpc.MetaDataValue.Builder value)
    Creates a new ProcessingInstruction.Builder with the given key and value.
    static io.axoniq.axonserver.grpc.ProcessingInstruction.Builder
    createProcessingInstruction(io.axoniq.axonserver.grpc.ProcessingKey key, String value)
    Creates a new ProcessingInstruction.Builder with the given key and value.
    static long
    numberOfResults(List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
    Retrieve the desired 'number of results' as a long from the given instructions, by searching for the ProcessingInstruction who's key equals the ProcessingKey.NR_OF_RESULTS.
    static int
    priority(List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
    Retrieve the priority as a int from the given instructions, by searching for the ProcessingInstruction who's key equals the ProcessingKey.PRIORITY.
    static String
    routingKey(List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
    Retrieve the routing key as a String from the given instructions, by searching for the ProcessingInstruction who's key equals the ProcessingKey.ROUTING_KEY.
    static long
    timeout(List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
    Retrieve the desired 'number of results' as a long from the given instructions, by searching for the ProcessingInstruction who's key equals the ProcessingKey.NR_OF_RESULTS.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • createProcessingInstruction

      public static io.axoniq.axonserver.grpc.ProcessingInstruction.Builder createProcessingInstruction(@Nonnull io.axoniq.axonserver.grpc.ProcessingKey key, @Nonnull io.axoniq.axonserver.grpc.MetaDataValue.Builder value)
      Creates a new ProcessingInstruction.Builder with the given key and value.
      Parameters:
      key - The ProcessingKey to set on the ProcessingInstruction.Builder
      value - The MetaDataValue.Builder to set on the ProcessingInstruction.Builder.
      Returns:
      A ProcessingInstruction.Builder initialized with the given key and value.
    • createProcessingInstruction

      public static io.axoniq.axonserver.grpc.ProcessingInstruction.Builder createProcessingInstruction(@Nonnull io.axoniq.axonserver.grpc.ProcessingKey key, @Nonnull String value)
      Creates a new ProcessingInstruction.Builder with the given key and value.
      Parameters:
      key - The ProcessingKey to set on the ProcessingInstruction.Builder.
      value - The String value to set in the MetaDataValue.Builder, which is then used to initialize the ProcessingInstruction.Builder.
      Returns:
      A ProcessingInstruction.Builder initialized with the provided key and value.
      See Also:
    • createProcessingInstruction

      public static io.axoniq.axonserver.grpc.ProcessingInstruction.Builder createProcessingInstruction(@Nonnull io.axoniq.axonserver.grpc.ProcessingKey key, boolean value)
      Creates a new ProcessingInstruction.Builder with the given key and value.
      Parameters:
      key - The ProcessingKey to set on the ProcessingInstruction.Builder.
      value - A boolean value used to initialize the MetaDataValue.Builder, which is then set on the ProcessingInstruction.Builder.
      Returns:
      A ProcessingInstruction.Builder initialized with the provided key and value.
      See Also:
    • createProcessingInstruction

      public static io.axoniq.axonserver.grpc.ProcessingInstruction.Builder createProcessingInstruction(@Nonnull io.axoniq.axonserver.grpc.ProcessingKey key, long value)
      Creates a new ProcessingInstruction.Builder with the given key and value.
      Parameters:
      key - The ProcessingKey to set on the ProcessingInstruction.Builder.
      value - The long value to set in the MetaDataValue.Builder, which is then used to initialize the ProcessingInstruction.Builder.
      Returns:
      A ProcessingInstruction.Builder initialized with the provided key and value.
      See Also:
    • routingKey

      public static String routingKey(@Nonnull List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
      Retrieve the routing key as a String from the given instructions, by searching for the ProcessingInstruction who's key equals the ProcessingKey.ROUTING_KEY.
      Parameters:
      instructions - The List of ProcessingInstructions to retrieve the ProcessingKey.ROUTING_KEY from.
      Returns:
      A String specifying the routing key for a given operation, or null if not found.
    • priority

      public static int priority(@Nonnull List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
      Retrieve the priority as a int from the given instructions, by searching for the ProcessingInstruction who's key equals the ProcessingKey.PRIORITY.
      Parameters:
      instructions - A List of ProcessingInstructions to retrieve the ProcessingKey.PRIORITY from.
      Returns:
      An int specifying the priority of a given operation.
    • numberOfResults

      public static long numberOfResults(@Nonnull List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
      Retrieve the desired 'number of results' as a long from the given instructions, by searching for the ProcessingInstruction who's key equals the ProcessingKey.NR_OF_RESULTS.
      Parameters:
      instructions - A List of ProcessingInstructions to retrieve the ProcessingKey.NR_OF_RESULTS from.
      Returns:
      A long specifying the desired 'number of results' for a given operation.
    • axonServerSupportsQueryStreaming

      public static boolean axonServerSupportsQueryStreaming(@Nonnull List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
      Retrieve whether Axon Server supports streaming from the given instructions, by searching for the value of ProcessingKey.SERVER_SUPPORTS_STREAMING.
      Parameters:
      instructions - A List of ProcessingInstructions to retrieve the ProcessingKey.SERVER_SUPPORTS_STREAMING from.
      Returns:
      true if Axon Server supports streaming, false otherwise.
    • clientSupportsQueryStreaming

      public static boolean clientSupportsQueryStreaming(@Nonnull List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
      Retrieve whether Client (query issuer) supports streaming from the given instructions, by searching for the value of ProcessingKey.CLIENT_SUPPORTS_STREAMING.
      Parameters:
      instructions - A List of ProcessingInstructions to retrieve the ProcessingKey.CLIENT_SUPPORTS_STREAMING from.
      Returns:
      true if Client supports streaming, false otherwise.
    • timeout

      public static long timeout(@Nonnull List<io.axoniq.axonserver.grpc.ProcessingInstruction> instructions)
      Retrieve the desired 'number of results' as a long from the given instructions, by searching for the ProcessingInstruction who's key equals the ProcessingKey.NR_OF_RESULTS.
      Parameters:
      instructions - A List of ProcessingInstructions to retrieve the ProcessingKey.NR_OF_RESULTS from.
      Returns:
      a long specifying the desired 'number of results' for a given operation