Class FlowableWorkerAnnotationBeanPostProcessor
java.lang.Object
org.flowable.external.worker.annotation.FlowableWorkerAnnotationBeanPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.SmartInitializingSingleton,org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor,org.springframework.core.Ordered
public class FlowableWorkerAnnotationBeanPostProcessor
extends Object
implements org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor, org.springframework.core.Ordered, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.SmartInitializingSingleton
Bean post-processor that registers methods annotated with
FlowableWorker to be invoked by a Flowable worker container created under the cover
by a FlowableWorkerContainerFactory according to the attributes of the annotation.
Annotated methods can use flexible arguments as defined by FlowableWorker.
This post-processor is automatically registered by the EnableFlowableWorker annotation.
Autodetects any FlowableWorkerConfigurer instances in the container, allowing for customization of the registry to be used, the default container
factory or for fine-grained control over endpoints registration. See the EnableFlowableWorker javadocs for complete usage details.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classAMessageHandlerMethodFactoryadapter that offers a configurable underlying instance to use. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.beans.factory.BeanFactoryprotected Stringprotected final AtomicIntegerprotected FlowableWorkerEndpointRegistryprotected org.springframework.beans.factory.config.BeanExpressionContextprotected final org.slf4j.Loggerprotected final FlowableWorkerEndpointRegistrarprotected org.springframework.beans.factory.config.BeanExpressionResolverFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected MethodFlowableWorkerEndpointInstantiate an emptyMethodFlowableWorkerEndpointfor further configuration with provided parameters inprocessFlowableWorker(org.flowable.external.worker.annotation.FlowableWorker, java.lang.reflect.Method, java.lang.Object).protected StringgetEndpointId(FlowableWorker flowableWorker) intgetOrder()postProcessAfterInitialization(Object bean, String beanName) postProcessBeforeInitialization(Object bean, String beanName) voidpostProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) protected voidprocessFlowableWorker(FlowableWorker flowableWorker, Method method, Object bean) Process the givenFlowableWorkerannotation on the given method, registering a corresponding endpoint for the given bean instance.protected Stringprotected ObjectresolveExpression(String value) protected DurationresolveExpressionAsDuration(String value, String attribute) protected IntegerresolveExpressionAsInteger(String value, String attribute) voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) Making aBeanFactoryavailable is optional; if not set,FlowableWorkerConfigurerbeans won't get autodetected and anendpoint registryhas to be explicitly configured.voidsetContainerFactoryBeanName(String containerFactoryBeanName) Set the name of theFlowableWorkerContainerFactoryto use by default.voidsetEndpointRegistry(FlowableWorkerEndpointRegistry endpointRegistry) Set theFlowableWorkerEndpointRegistrythat will hold the created endpoint and manage the lifecycle of the related worker container.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.support.MergedBeanDefinitionPostProcessor
resetBeanDefinition
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
containerFactoryBeanName
-
endpointRegistry
-
messageHandlerMethodFactory
protected final FlowableWorkerAnnotationBeanPostProcessor.MessageHandlerMethodFactoryAdapter messageHandlerMethodFactory -
beanFactory
protected org.springframework.beans.factory.BeanFactory beanFactory -
resolver
protected org.springframework.beans.factory.config.BeanExpressionResolver resolver -
expressionContext
protected org.springframework.beans.factory.config.BeanExpressionContext expressionContext -
registrar
-
counter
-
nonAnnotatedClasses
-
-
Constructor Details
-
FlowableWorkerAnnotationBeanPostProcessor
public FlowableWorkerAnnotationBeanPostProcessor()
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
setContainerFactoryBeanName
Set the name of theFlowableWorkerContainerFactoryto use by default.If none is specified, "flowableWorkerContainerFactory" is assumed to be defined.
-
setEndpointRegistry
Set theFlowableWorkerEndpointRegistrythat will hold the created endpoint and manage the lifecycle of the related worker container. -
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) Making aBeanFactoryavailable is optional; if not set,FlowableWorkerConfigurerbeans won't get autodetected and anendpoint registryhas to be explicitly configured.- Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiatedin interfaceorg.springframework.beans.factory.SmartInitializingSingleton
-
postProcessMergedBeanDefinition
public void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) - Specified by:
postProcessMergedBeanDefinitionin interfaceorg.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
-
postProcessBeforeInitialization
public Object postProcessBeforeInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException - Specified by:
postProcessBeforeInitializationin interfaceorg.springframework.beans.factory.config.BeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
postProcessAfterInitialization
public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException - Specified by:
postProcessAfterInitializationin interfaceorg.springframework.beans.factory.config.BeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
processFlowableWorker
Process the givenFlowableWorkerannotation on the given method, registering a corresponding endpoint for the given bean instance.- Parameters:
flowableWorker- the annotation to processmethod- the annotated methodbean- the instance to invoke the method on- See Also:
-
createMethodFlowableWorkerEndpoint
Instantiate an emptyMethodFlowableWorkerEndpointfor further configuration with provided parameters inprocessFlowableWorker(org.flowable.external.worker.annotation.FlowableWorker, java.lang.reflect.Method, java.lang.Object).- Returns:
- a new
MethodFlowableWorkerEndpointor subclass thereof
-
getEndpointId
-
resolveExpressionAsDuration
-
resolveExpressionAsInteger
-
resolveExpression
-
resolve
-