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
Nested ClassesModifier and TypeClassDescriptionstatic final classThe Java Bean to represent a Control Bus command as a bean method with its parameter types. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReturn 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) voidpostProcessBeforeDestruction(Object bean, String beanName) voidregisterControlBusCommands(String beanName, Object bean) Manually register Control Bus commands (if any) for a specific bean.booleanrequiresDestruction(Object bean) voidsetApplicationContext(ApplicationContext applicationContext) voidsetEagerInitialization(boolean eagerInitialization) Set totrueto 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, waitMethods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessBeforeInitialization
-
Constructor Details
-
ControlBusCommandRegistry
public ControlBusCommandRegistry()
-
-
Method Details
-
setEagerInitialization
public void setEagerInitialization(boolean eagerInitialization) Set totrueto turn on Control Bus commands loading after application context initialization.- Parameters:
eagerInitialization- true to initialize this registry eagerly.
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiatedin interfaceSmartInitializingSingleton
-
postProcessAfterInitialization
- Specified by:
postProcessAfterInitializationin 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, orIntegrationManagedResourceannotation.- Parameters:
beanName- the bean name for registrationbean- the bean for registration
-
requiresDestruction
- Specified by:
requiresDestructionin interfaceDestructionAwareBeanPostProcessor
-
postProcessBeforeDestruction
- Specified by:
postProcessBeforeDestructionin 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.) IfbeanNameis 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 theControlBusMethodFilterrequirements 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.
-