Class ConnectionFactoryContextWrapper

java.lang.Object
org.springframework.amqp.rabbit.connection.ConnectionFactoryContextWrapper

public class ConnectionFactoryContextWrapper extends Object
Helper class to handle ConnectionFactory context binding and unbinding when executing instructions.
Since:
2.3
Author:
Wander Costa, Artem Bilan
  • Constructor Details

    • ConnectionFactoryContextWrapper

      public ConnectionFactoryContextWrapper(ConnectionFactory connectionFactory)
  • Method Details

    • call

      public <T> T call(Callable<T> callable)
      Execute a Callable binding to the default ConnectionFactory and finally unbinding it.
      Type Parameters:
      T - the return type.
      Parameters:
      callable - the Callable object to be executed.
      Returns:
      the result of the Callable.
    • call

      public <T> T call(@Nullable String contextName, Callable<T> callable)
      Execute a Callable binding the given ConnectionFactory and finally unbinding it.
      Type Parameters:
      T - the return type.
      Parameters:
      contextName - the name of the context. In null, empty or blank, default context is bound.
      callable - the Callable object to be executed.
      Returns:
      the result of the Callable.
    • run

      public void run(Runnable runnable)
      Execute a Runnable binding to the default ConnectionFactory and finally unbinding it.
      Parameters:
      runnable - the Runnable object to be executed.
      Throws:
      RuntimeException - when a RuntimeException is thrown by the Runnable.
    • run

      public void run(@Nullable String contextName, Runnable runnable)
      Execute a Runnable binding the given ConnectionFactory and finally unbinding it.
      Parameters:
      contextName - the name of the context. In null, empty or blank, default context is bound.
      runnable - the Runnable object to be executed.
      Throws:
      RuntimeException - when a RuntimeException is thrown by the Runnable.