Class ConnectionFactoryContextWrapper
- java.lang.Object
-
- org.springframework.amqp.rabbit.connection.ConnectionFactoryContextWrapper
-
public class ConnectionFactoryContextWrapper extends java.lang.ObjectHelper class to handleConnectionFactorycontext binding and unbinding when executing instructions.- Since:
- 2.3
- Author:
- Wander Costa, Artem Bilan
-
-
Constructor Summary
Constructors Constructor Description ConnectionFactoryContextWrapper(ConnectionFactory connectionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tcall(java.lang.String contextName, java.util.concurrent.Callable<T> callable)Execute aCallablebinding the givenConnectionFactoryand finally unbinding it.<T> Tcall(java.util.concurrent.Callable<T> callable)Execute aCallablebinding to the defaultConnectionFactoryand finally unbinding it.voidrun(java.lang.Runnable runnable)Execute aRunnablebinding to the defaultConnectionFactoryand finally unbinding it.voidrun(java.lang.String contextName, java.lang.Runnable runnable)Execute aRunnablebinding the givenConnectionFactoryand finally unbinding it.
-
-
-
Constructor Detail
-
ConnectionFactoryContextWrapper
public ConnectionFactoryContextWrapper(ConnectionFactory connectionFactory)
-
-
Method Detail
-
call
public <T> T call(java.util.concurrent.Callable<T> callable)
Execute aCallablebinding to the defaultConnectionFactoryand finally unbinding it.- Type Parameters:
T- the return type.- Parameters:
callable- theCallableobject to be executed.- Returns:
- the result of the
Callable.
-
call
public <T> T call(@Nullable java.lang.String contextName, java.util.concurrent.Callable<T> callable)
Execute aCallablebinding the givenConnectionFactoryand 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- theCallableobject to be executed.- Returns:
- the result of the
Callable.
-
run
public void run(java.lang.Runnable runnable)
Execute aRunnablebinding to the defaultConnectionFactoryand finally unbinding it.- Parameters:
runnable- theRunnableobject to be executed.- Throws:
java.lang.RuntimeException- when a RuntimeException is thrown by theRunnable.
-
run
public void run(@Nullable java.lang.String contextName, java.lang.Runnable runnable)
Execute aRunnablebinding the givenConnectionFactoryand finally unbinding it.- Parameters:
contextName- the name of the context. In null, empty or blank, default context is bound.runnable- theRunnableobject to be executed.- Throws:
java.lang.RuntimeException- when a RuntimeException is thrown by theRunnable.
-
-