|
| 1 | +--- |
| 2 | +title: "Action" |
| 3 | +date: 2023-07-06T15:06:20+02:00 |
| 4 | +draft: false |
| 5 | +weight: 4 |
| 6 | +--- |
| 7 | + |
| 8 | +{{< feature-state for_mw_version="0.1" state="alpha" >}} |
| 9 | + |
| 10 | +- [What is it for?](#what-is-it-for) |
| 11 | +- [Installation](#installation) |
| 12 | +- [Basic Usage](#basic-usage) |
| 13 | +- [Advanced Usage](#advanced-usage) |
| 14 | + - [Using expressions](#using-expressions) |
| 15 | + - [Adding logger](#adding-logger) |
| 16 | + - [Adding state](#adding-state) |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +> An action is a process that enables a task to be carried out before, during or at the end of the execution of a workflow. |
| 21 | +
|
| 22 | +## What is it for? |
| 23 | + |
| 24 | +This package provides a process capable of executing actions. |
| 25 | + |
| 26 | +## Installation |
| 27 | + |
| 28 | +```shell |
| 29 | +composer require php-etl/action |
| 30 | +``` |
| 31 | + |
| 32 | +## Basic usage |
| 33 | + |
| 34 | +At present, actions can only be used within a workflow. It is therefore not currently possible to launch an action on its own. |
| 35 | + |
| 36 | +```yaml |
| 37 | +workflow: |
| 38 | + jobs: |
| 39 | + - action: # ... |
| 40 | + - pipeline: # ... |
| 41 | + - action: # ... |
| 42 | +``` |
| 43 | +
|
| 44 | +## Advanced usage |
| 45 | +
|
| 46 | +### Using expressions |
| 47 | +
|
| 48 | +It's possible to use expressions in your pipeline using the `expression_language` option. To use these expressions, |
| 49 | +you need to use our customised Providers which provide the different expressions. For more information, please visit |
| 50 | +the [detailed documentation](../../feature/expression-language) of the language expressions. |
| 51 | + |
| 52 | +```yaml |
| 53 | +action: |
| 54 | + expression_language: |
| 55 | + - 'Kiboko\Component\Satellite\ExpressionLanguage\Provider' |
| 56 | +``` |
| 57 | + |
| 58 | +### Adding logger |
| 59 | + |
| 60 | +It's possible to add a `logger` at each action of a workflow. |
| 61 | + |
| 62 | +For more details, go to the [detailed logger documentation](../../feature/logger). |
| 63 | + |
| 64 | +```yaml |
| 65 | +satellite: |
| 66 | + # ... |
| 67 | + workflow: |
| 68 | + jobs: |
| 69 | + - action: |
| 70 | + # ... |
| 71 | + logger: |
| 72 | + channel: pipeline |
| 73 | + destinations: |
| 74 | + - elasticsearch: |
| 75 | + level: warning |
| 76 | + hosts: |
| 77 | + - http://user:password@elasticsearch.example.com:9200 |
| 78 | +``` |
| 79 | + |
| 80 | +### Adding state |
| 81 | + |
| 82 | +It's possible to add a `state` at each action of a workflow. |
| 83 | + |
| 84 | +For more details, go to the [detailed state documentation](../../feature/state) |
| 85 | + |
| 86 | +```yaml |
| 87 | +satellite: |
| 88 | +# ... |
| 89 | + workflow: |
| 90 | + jobs: |
| 91 | + - action: |
| 92 | + # ... |
| 93 | + state: |
| 94 | + destinations: |
| 95 | + - rabbitmq: |
| 96 | + host: rabbitmq.example.com |
| 97 | + vhost: / |
| 98 | + topic: foo.rejects |
| 99 | +``` |
| 100 | + |
| 101 | +> As you can see, actions are only able to manage the logs and states of their processes, |
| 102 | +> but cannot deal with rejects that are contrary to pipelines. |
0 commit comments