Class ConnectionFactoryContextWrapper
- java.lang.Object
-
- org.springframework.amqp.rabbit.connection.ConnectionFactoryContextWrapper
-
public class ConnectionFactoryContextWrapper extends java.lang.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(java.lang.String contextName, java.util.concurrent.Callable<T> callable)
Execute aCallable
binding the givenConnectionFactory
and finally unbinding it.<T> T
call(java.util.concurrent.Callable<T> callable)
Execute aCallable
binding to the defaultConnectionFactory
and finally unbinding it.void
run(java.lang.Runnable runnable)
Execute aRunnable
binding to the defaultConnectionFactory
and finally unbinding it.void
run(java.lang.String contextName, java.lang.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(java.util.concurrent.Callable<T> callable)
Execute aCallable
binding to the defaultConnectionFactory
and finally unbinding it.- Type Parameters:
T
- the return type.- Parameters:
callable
- theCallable
object 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 aCallable
binding the givenConnectionFactory
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
- theCallable
object to be executed.- Returns:
- the result of the
Callable
.
-
run
public void run(java.lang.Runnable runnable)
Execute aRunnable
binding to the defaultConnectionFactory
and finally unbinding it.- Parameters:
runnable
- theRunnable
object 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 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:
java.lang.RuntimeException
- when a RuntimeException is thrown by theRunnable
.
-
-