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.

Author:
Filip Hrisafov
See Also:
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
    • containerFactoryBeanName

      protected String containerFactoryBeanName
    • endpointRegistry

      protected FlowableWorkerEndpointRegistry endpointRegistry
    • 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

      protected final FlowableWorkerEndpointRegistrar registrar
    • counter

      protected final AtomicInteger counter
    • nonAnnotatedClasses

      protected final Set<Class<?>> nonAnnotatedClasses
  • Constructor Details

    • FlowableWorkerAnnotationBeanPostProcessor

      public FlowableWorkerAnnotationBeanPostProcessor()
  • Method Details

    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • setContainerFactoryBeanName

      public void setContainerFactoryBeanName(String containerFactoryBeanName)
      Set the name of the FlowableWorkerContainerFactory to use by default.

      If none is specified, "flowableWorkerContainerFactory" is assumed to be defined.

    • setEndpointRegistry

      public void setEndpointRegistry(FlowableWorkerEndpointRegistry endpointRegistry)
      Set the FlowableWorkerEndpointRegistry that 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 a BeanFactory available is optional; if not set, FlowableWorkerConfigurer beans won't get autodetected and an endpoint registry has to be explicitly configured.
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
    • afterSingletonsInstantiated

      public void afterSingletonsInstantiated()
      Specified by:
      afterSingletonsInstantiated in interface org.springframework.beans.factory.SmartInitializingSingleton
    • postProcessMergedBeanDefinition

      public void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, Class<?> beanType, String beanName)
      Specified by:
      postProcessMergedBeanDefinition in interface org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
    • postProcessBeforeInitialization

      public Object postProcessBeforeInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
      Specified by:
      postProcessBeforeInitialization in interface org.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:
      postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
      Throws:
      org.springframework.beans.BeansException
    • processFlowableWorker

      protected void processFlowableWorker(FlowableWorker flowableWorker, Method method, Object bean)
      Process the given FlowableWorker annotation on the given method, registering a corresponding endpoint for the given bean instance.
      Parameters:
      flowableWorker - the annotation to process
      method - the annotated method
      bean - the instance to invoke the method on
      See Also:
    • createMethodFlowableWorkerEndpoint

      protected MethodFlowableWorkerEndpoint createMethodFlowableWorkerEndpoint()
      Returns:
      a new MethodFlowableWorkerEndpoint or subclass thereof
    • getEndpointId

      protected String getEndpointId(FlowableWorker flowableWorker)
    • resolveExpressionAsDuration

      protected Duration resolveExpressionAsDuration(String value, String attribute)
    • resolveExpressionAsInteger

      protected Integer resolveExpressionAsInteger(String value, String attribute)
    • resolveExpression

      protected Object resolveExpression(String value)
    • resolve

      protected String resolve(String value)