Annotation Interface EnableFlowableWorker
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@Import(FlowableWorkerBootstrapConfiguration.class)
public @interface EnableFlowableWorker
Enable Flowable Worker annotated endpoints that are created under the cover by a
FlowableWorkerContainerFactory.
To be used on a @Configuration classes as follows:
@Configuration
@EnableFlowableWorker
public class AppConfig {
@Bean
public DefaultFlowableWorkerContainerFactory flowableWorkerContainerFactory(ExternalWorkerClient externalWorkerClient) {
DefaultFlowableWorkerContainerFactory factory = new DefaultFlowableWorkerContainerFactory();
factory.setExternalWorkerClient(externalWorkerClient);
return factory;
}
}
The FlowableWorkerContainerFactory is responsible for creating the worker container responsible for a particular endpoint.
Typical implementations as the DefaultFlowableWorkerContainerFactory
used in the sample above, provide the necessary configuration options that are supported by the underlying FlowableWorkerContainer.
@EnableFlowableWorker enables the detction of @FlowableWorker annotations
on any Spring-managed bean in the container.
For example given a class DemoWorker
package com.example.demo
@Component
public class DemoWorker {
@FlowableWorker(topic = "customer")
public void process(AcquiredExternalWorkerJob job) {
// Process the job
}
}
Annotated methods can use flexible signature; in particular, it is possible to use WorkerResult
to control whether the job processing has been successful or not. See @FlowableWorker javadoc for more details.
- Author:
- Filip Hrisafov
- See Also: