Tasks
Tasks are essentially actions executed against the SAP system, containing either an RFC or a REST service call, along with necessary property mappings.
Each action must be defined in a separate file located under the /configs/tasks/
folder of aqishare.
We recommend choosing a file name for tasks that briefly describes the function it performs. This practice improve clarity and organization within the configuration. Examples include barcode.yaml
, replicateMetadata.yaml
, or startSAPWorkflow.yaml
, where each name indicates the task's primary role or operation.
It is also possible to create a subfolder structure under the /config/tasks/
folder and place the files there.
Parameter Overview
The table highlights all available parameters to specify a task in the corresponding task file.
Parameter | Mandatory | Type | Default | Description |
---|---|---|---|---|
enabled | No | Boolean | true | If set to false , the task is disabled and will not processed. |
storage | Yes | String | The value of the name parameter in the related storage.yaml to which the task should connect.Refer to chapter storage.yaml. | |
sap | Yes | String | The value of the name parameter in the related sapConnection.yaml to which the task should connect.Refer to chapter sapConnection.yaml. | |
trigger | Yes | Object | Defines the execution of the task, either periodically through a CRON expression or on demand via an access key to manually trigger the task. Refer below to section Parameter trigger . | |
query | Yes | Object | Defines the query which will be executed against the repository (storage) to retrieve data that should be processed. Refer below to section Parameter query . | |
mapping | Yes | Object | Specifies the SAP function module or REST service, and defines the property mapping to be passed to SAP, as well as the property mapping of the result to the repository's properties. Refer below to section Parameter mapping . | |
maxRetry | No | Number | 3 | The total number of attempts to retry the job before marking it as an error. If this number is exceeded, the document will be excluded from each subsequent run. |
priority | No | Number | 1 | Change the priority of this job queue. |
retention | No | Duration | 0m | Duration for a task to remain in the queue after successful completion, such as 5m or 1h . |
timeout | No | Duration | 3m | Specify a timeout to ensure that if the task isn't processed within that period or before the deadline, the server can abandon the work to reclaim resources for other tasks. |
Parameter trigger
The trigger controls how tasks are initiated. This can be done either automatically via a CRON expression or manually through an access token from third-party systems.
Parameter | Mandatory | Type | Description |
---|---|---|---|
cron | Yes | String | The CRON expression used to automatically invoke the task at specified intervals. CRON expressions define a schedule for recurring tasks, allowing for precise control over when the task is executed. |
accessToken | No | String | An arbitrary token is used to allow manual triggering of each task from any third-party system. Ensure that each task has a unique token to avoid conflicts and maintain security. It is advisable to use a randomly generated token with at least 50 characters to minimize the risk of unauthorized access. If this parameter is not set, invoking the task from third-party systems is not possible. |
The below example configuration of the trigger parameter illustrates its use with a CRON expression (set to run every full minute) and the option to trigger the task at any time externally using an accessToken.
trigger:
cron: '* * * * *'
accessToken: 'eyJhbGciOiJIUzI1NiJ9.eyJSb2xlIjoiQWRtaW4iLCJJc3N1Z'
Manually trigger a Task using an accessToken
To manually trigger a Task, an accessToken must be specified. The value of this token should be included in the App-Auth
header of the request. The endpoint on the aqishare server is /tasks/
, followed by the name of the task file, excluding the file extension.
Assuming the task is defined in the file /tasks/barcode.yaml and the accessToken is set to the value from the example above, the request should be formatted as follows:
curl --location --request GET 'http://<aqishare-server>:3001/tasks/barcode' \
--header 'App-Auth: eyJhbGciOiJIUzI1NiJ9.eyJSb2xlIjoiQWRtaW4iLCJJc3N1Z'
Trigger the action on the SAP side via the accessToken
may require a full-paid SAP user (SID) for the connection defined in sapConnection.yaml.
Parameter query
The query parameter specifies the query sent to the repository to search for related documents. Given that the underlying repositories differ significantly, necessitating distinct handling approaches, the documentation for this parameter is segregated based on the specific repository to enhance clarity.
🗃️ Parameter query
2 Einträge
🗃️ Parameter mapping
2 Einträge
Parameter mapping
Themapping parameter specifies the RFC function module or REST service call. It also defines the return mapping, which assigns return values to properties in the repository. Since the specifications for RFC and REST differ significantly, the documentation for this parameter is separated to enhance clarity.