|
1 | 1 | # Flowable External Worker Library for Java |
2 | 2 |
|
3 | | -To use Flowable together with a Java application external workers can be used. |
4 | | -This project allows to connect a Java library to Flowable. |
5 | | -To connect to a Flowable installation it is required [to authenticate](#authentication). |
6 | | -With the client it is possible to specify a callback method which is called for every job executed. |
| 3 | +An _External Worker Task_ in BPMN or CMMN is a task where the custom logic of that task is executed externally to Flowable, i.e. on another server. |
| 4 | +When the process or case engine arrives at such a task, it will create an **external job**, which is exposed over the REST API. |
| 5 | +Through this REST API, the job can be acquired and locked. Once locked, the custom logic is responsible for signalling over REST that the work is done and the process or case can continue. |
7 | 6 |
|
8 | | -## Authentication |
9 | | - |
10 | | -There are 2 ways that the application can be authenticated with a Flowable installation. |
11 | | - |
12 | | -* Using HTTP Basic authentication with a provided username and password |
13 | | -* Using HTTP Bearer authentication with a provided access token |
| 7 | +This project makes implementing such custom logic in Java easy by not having the worry about the low-level details of the REST API and focus on the actual custom business logic. Integrations for other languages are available, too. |
14 | 8 |
|
15 | 9 | ## Spring Boot Sample |
16 | 10 |
|
@@ -75,22 +69,47 @@ public class ExampleWorker { |
75 | 69 | ``` |
76 | 70 |
|
77 | 71 |
|
78 | | -### Local |
| 72 | +### Connection properties |
79 | 73 |
|
80 | | -The following properties are example how you can connect to a Flowable instance running at `http://host.docker.internal:8090` |
| 74 | +The following properties show how you can connect to a Flowable instance running at `http://host.docker.internal:8090` using basic authentication: |
81 | 75 |
|
82 | 76 | ```properties |
83 | 77 | flowable.external.worker.rest.base-url=http://host.docker.internal:8090 |
84 | 78 | flowable.external.worker.rest.authentication.basic.username=admin |
85 | 79 | flowable.external.worker.rest.authentication.basic.password=test |
86 | 80 | ``` |
87 | 81 |
|
88 | | -### Cloud |
| 82 | +The context path can also be changed, if necessary: |
| 83 | + |
| 84 | +```properties |
| 85 | +flowable.external.worker.rest.context-path=/external-job-api |
| 86 | +``` |
| 87 | + |
| 88 | +## Authentication |
89 | 89 |
|
90 | | -The usage with Flowable Cloud is simpler, since everything is pre-configured. |
91 | | -However, it's required to either use the user credentials or to pre-configure a personal access token. |
| 90 | +There are two ways that the application can be authenticated with a Flowable installation: |
| 91 | + |
| 92 | +* Using HTTP Basic authentication with a provided username and password, as shown in the example above. |
| 93 | +* Using HTTP Bearer authentication with a provided access token. In that case the `.basic` properties are replaced by the `flowable.external.worker.rest.authentication.bearer.token=myTokenValue` property. |
| 94 | + |
| 95 | +### Flowable Cloud |
| 96 | + |
| 97 | +Connecting an external worker to the Flowable Cloud is simpler, since everything is pre-configured. |
| 98 | +It's required to either use the user credentials or to pre-configure a personal access token, for example: |
92 | 99 |
|
93 | 100 |
|
94 | 101 | ```properties |
95 | 102 | flowable.external.worker.rest.authentication.bearer.token=<personal-access-token> |
96 | 103 | ``` |
| 104 | + |
| 105 | +### Advanced Properties |
| 106 | + |
| 107 | +The following properties are for advanced usage. Only change these if you understand the consequences and the concept of the external worker properly. |
| 108 | + |
| 109 | +* `flowable.external.worker.workerId` : gives the external worker a custom identifier, which is used to identify which external worker has locked an external worker job. |
| 110 | +* `flowable.external.worker.concurrency` : The amount of threads available to poll and execute external worker jobs. By default `1`. |
| 111 | +* `flowable.external.worker.lock-duration` : The amount of time an external job will be locked when acquired. If this time limit is reached, other external workers will be able to acquire the same job. By default 5 minutes. |
| 112 | +* `flowable.external.worker.number-of-retries` : The number of times to retry acquiring new jobs on the Floable server-side before giving up. By default 5. |
| 113 | +* `flowable.external.worker.number-of-tasks` : The amount of external worker tasks to acquire and lock in one go. The default is `1`. |
| 114 | +* `flowable.external.worker.polling-interval` : The amount of time between polling for new external worker jobs. By default 5 seconds. |
| 115 | + |
0 commit comments