Class ControlBusCommandRegistry
java.lang.Object
org.springframework.integration.support.management.ControlBusCommandRegistry
- All Implemented Interfaces:
Aware
,BeanPostProcessor
,DestructionAwareBeanPostProcessor
,SmartInitializingSingleton
,ApplicationContextAware
public class ControlBusCommandRegistry
extends Object
implements ApplicationContextAware, SmartInitializingSingleton, DestructionAwareBeanPostProcessor
A global component to serve Control Bus command and respective SpEL expression relationships.
- Since:
- 6.4
- Author:
- Artem Bilan
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
The Java Bean to represent a Control Bus command as a bean method with its parameter types. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Return registered Control Bus commands.getExpressionForCommand
(String command, Class<?>... parameterTypes) Obtain a SpEL expression for the command to call with parameter types.postProcessAfterInitialization
(Object bean, String beanName) void
postProcessBeforeDestruction
(Object bean, String beanName) void
registerControlBusCommands
(String beanName, Object bean) Manually register Control Bus commands (if any) for a specific bean.void
setApplicationContext
(ApplicationContext applicationContext) void
setEagerInitialization
(boolean eagerInitialization) Set totrue
to turn on Control Bus commands loading after application context initialization.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessBeforeInitialization
Methods inherited from interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
requiresDestruction
-
Constructor Details
-
ControlBusCommandRegistry
public ControlBusCommandRegistry()
-
-
Method Details
-
setEagerInitialization
public void setEagerInitialization(boolean eagerInitialization) Set totrue
to turn on Control Bus commands loading after application context initialization.- Parameters:
eagerInitialization
- true to initialize this registry eagerly.
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiated
in interfaceSmartInitializingSingleton
-
postProcessAfterInitialization
- Specified by:
postProcessAfterInitialization
in interfaceBeanPostProcessor
- Throws:
BeansException
-
registerControlBusCommands
Manually register Control Bus commands (if any) for a specific bean. The bean must be in instance ofLifecycle
, orCustomizableThreadCreator
, or marked with theManagedResource
, orIntegrationManagedResource
annotation.- Parameters:
beanName
- the bean name for registrationbean
- the bean for registration
-
postProcessBeforeDestruction
- Specified by:
postProcessBeforeDestruction
in interfaceDestructionAwareBeanPostProcessor
- Throws:
BeansException
-
getCommands
Return registered Control Bus commands.- Returns:
- registered commands.
-
getExpressionForCommand
Obtain a SpEL expression for the command to call with parameter types. The command must be in formatbeanName.methodName
. (Or@beanName.methodName()
for backward compatibility with simple expressions.) IfbeanName
is a complex literal, it has to be wrapped into single quotes, e.g.'some.complex.bean-name'
. The target method to call must fit into theControlBusMethodFilter
requirements and match with the provided parameter types.- Parameters:
command
- the command to call.parameterTypes
- the parameter types for the target method to call.- Returns:
- the SpEL expression for the provided command.
- Throws:
IllegalArgumentException
- if provided command does not match to Control Bus requirements or target method contract.
-