Class ConnectionFactoryContextWrapper
- java.lang.Object
-
- org.springframework.amqp.rabbit.connection.ConnectionFactoryContextWrapper
-
public class ConnectionFactoryContextWrapper extends Object
Helper 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(String contextName, Callable<T> callable)Execute aCallablebinding the givenConnectionFactoryand finally unbinding it.<T> Tcall(Callable<T> callable)Execute aCallablebinding to the defaultConnectionFactoryand finally unbinding it.voidrun(Runnable runnable)Execute aRunnablebinding to the defaultConnectionFactoryand finally unbinding it.voidrun(String contextName, Runnable runnable)Execute aRunnablebinding the givenConnectionFactoryand finally unbinding it.
-
-
-
Constructor Detail
-
ConnectionFactoryContextWrapper
public ConnectionFactoryContextWrapper(ConnectionFactory connectionFactory)
-
-
Method Detail
-
call
public <T> T call(Callable<T> callable)
Execute aCallablebinding to the defaultConnectionFactoryand finally unbinding it.
-
call
public <T> T call(@Nullable String contextName, Callable<T> callable)
Execute aCallablebinding the givenConnectionFactoryand finally unbinding it.
-
run
public void run(Runnable runnable)
Execute aRunnablebinding to the defaultConnectionFactoryand finally unbinding it.- Parameters:
runnable- theRunnableobject to be executed.- Throws:
RuntimeException- when a RuntimeException is thrown by theRunnable.
-
run
public void run(@Nullable String contextName, 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:
RuntimeException- when a RuntimeException is thrown by theRunnable.
-
-