Class ConnectionFactoryContextWrapper
- java.lang.Object
-
- org.springframework.amqp.rabbit.connection.ConnectionFactoryContextWrapper
-
public class ConnectionFactoryContextWrapper extends Object
Helper class to handleConnectionFactory
context 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> T
call(String contextName, Callable<T> callable)
Execute aCallable
binding the givenConnectionFactory
and finally unbinding it.<T> T
call(Callable<T> callable)
Execute aCallable
binding to the defaultConnectionFactory
and finally unbinding it.void
run(Runnable runnable)
Execute aRunnable
binding to the defaultConnectionFactory
and finally unbinding it.void
run(String contextName, Runnable runnable)
Execute aRunnable
binding the givenConnectionFactory
and finally unbinding it.
-
-
-
Constructor Detail
-
ConnectionFactoryContextWrapper
public ConnectionFactoryContextWrapper(ConnectionFactory connectionFactory)
-
-
Method Detail
-
call
public <T> T call(Callable<T> callable)
Execute aCallable
binding to the defaultConnectionFactory
and finally unbinding it.
-
call
public <T> T call(@Nullable String contextName, Callable<T> callable)
Execute aCallable
binding the givenConnectionFactory
and finally unbinding it.
-
run
public void run(Runnable runnable)
Execute aRunnable
binding to the defaultConnectionFactory
and finally unbinding it.- Parameters:
runnable
- theRunnable
object to be executed.- Throws:
RuntimeException
- when a RuntimeException is thrown by theRunnable
.
-
run
public void run(@Nullable String contextName, Runnable runnable)
Execute aRunnable
binding the givenConnectionFactory
and finally unbinding it.- Parameters:
contextName
- the name of the context. In null, empty or blank, default context is bound.runnable
- theRunnable
object to be executed.- Throws:
RuntimeException
- when a RuntimeException is thrown by theRunnable
.
-
-