Class ProtonUtils

java.lang.Object
org.springframework.amqp.client.ProtonUtils

public final class ProtonUtils extends Object
Utility methods between ProtonJ and Spring API.
Since:
4.1
Author:
Artem Bilan
  • Method Details

    • toProtonMessage

      public static org.apache.qpid.protonj2.client.Message<?> toProtonMessage(Message message)
      Convert a Spring AMQP message to a ProtonJ message.
      Parameters:
      message - the Spring AMQP message to convert from.
      Returns:
      the ProtonJ message based on the provided Spring AMQP message.
    • fromProtonMessage

      public static Message fromProtonMessage(org.apache.qpid.protonj2.client.Message<?> message)
      Convert a ProtonJ message to the Spring AMQP message. Only messages with binary body are supported.
      Parameters:
      message - the ProtonJ message to convert from.
      Returns:
      the Spring AMQP message based on the provided ProtonJ message.
    • toSupplier

      public static <T> Supplier<T> toSupplier(Future<T> future, long timeout)
      Convert a Future to a Supplier.
      Type Parameters:
      T - the value type.
      Parameters:
      future - the future to covert from.
      timeout - for how long to wait for the Future result.
      Returns:
      a Supplier calling the provided Future.
    • toAmqpException

      public static AmqpException toAmqpException(Exception ex)
      Wrap an exception to an AmqpException implementation.
      Parameters:
      ex - the exception from Proton client to wrap.
      Returns:
      the AmqpException implementation.
    • toAmqpException

      public static AmqpException toAmqpException(ExecutionException ex)
      Wrap an ExecutionException to an AmqpException implementation.
      Parameters:
      ex - the exception from Proton client to wrap.
      Returns:
      the AmqpException implementation.
    • toAmqpException

      public static AmqpException toAmqpException(org.apache.qpid.protonj2.client.exceptions.ClientException ex)
      Wrap an ClientException to an AmqpException implementation.
      Parameters:
      ex - the exception from Proton client to wrap.
      Returns:
      the AmqpException implementation.