-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move robocorp client to separate directory and add initial setup.py
- Loading branch information
Showing
12 changed files
with
176 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Flowable Robocorp Client | ||
|
||
[License: | ||
![license](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/flowable/flowable-external-client-python/blob/main/LICENSE) | ||
|
||
![Flowable Actions CI](https://github.com/flowable/flowable-external-client-python/actions/workflows/main.yml/badge.svg?branch=main) | ||
|
||
This is a python module to connect a Flowable installation through an external worker with a Robocorp task or action. | ||
This allows to execute a Robocorp task/action from a business process with BPMN or a case diagram CMMN. | ||
The application is started with a task/action definition from Robocorp and connects to an external worker topic. | ||
When using the Robocorp task in Flowable, it is possible to specify a task/action name. | ||
In the task, the specific task/action specified will be executed and the result (only for actions) will be sent back to the process. | ||
It is required that the variables in the diagram match exactly the variables inside the robocorp task/action. | ||
|
||
## Sample | ||
|
||
The following [diagram BPMN](docs/robocorpExample.bpmn) illustrates a basic usage of the Robocorp task: | ||
|
||
![Simple BPMN diagram with a start event, a robocorp task and an end event](docs/robocorpExample.png) | ||
|
||
The following example `get-weather-forecast.py` can be used as a Robocorp action: | ||
```python | ||
from robocorp.actions import action | ||
|
||
@action | ||
def get_weather_forecast(city: str, days: int, scale: str = "celsius") -> str: | ||
""" | ||
Returns weather conditions forecast for a given city. | ||
Args: | ||
city (str): Target city to get the weather conditions for | ||
days: How many day forecast to return | ||
scale (str): Temperature scale to use, should be one of "celsius" or "fahrenheit" | ||
Returns: | ||
object: The requested weather conditions forecast with the temperature as one element | ||
""" | ||
|
||
# your implementation goes here... | ||
|
||
return { | ||
"temperature": "the weather will be nice" | ||
} | ||
``` | ||
|
||
The Robocorp worker can be started with the following command: | ||
```sh | ||
python -m flowable.robocorp_client --flowable-token <your-token> myTopic action get-weather-forecast.py | ||
``` | ||
|
||
You can request `<your-token>` at the [Flowable Trial](https://trial.flowable.com/work/) by clicking at the bottom left on your user and go to Settings. | ||
Once in the settings, choose "Access Token" and press the button "New token". | ||
After providing name and the validity, the token is generated and can be set. | ||
|
||
Once the module is started and a process instance is created, it will automatically execute the Robocorp action and returns the result to Flowable. | ||
The Python module will keep running until stopped to process potential additional jobs. | ||
|
||
## Authentication | ||
|
||
Next to the cloud authentication, it's possible to authenticate against other hosts. | ||
The hostname can be specified with `--flowable-host`. | ||
|
||
For the authentication there are two possibilities: | ||
|
||
1. Providing a bearer token with the `--flowable-token <token>` attribute. | ||
2. Providing basic authentication with `--flowable-username <username>` and `--flowable-password <password>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:design="http://flowable.org/design" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://flowable.org/test" design:palette="flowable-work-process-palette"> | ||
<process id="robocorpExample" name="Robocorp Example" isExecutable="true" flowable:candidateStarterGroups="flowableUser"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[BPMNDiagram]]></design:stencilid> | ||
<design:creationdate><![CDATA[2024-09-20T12:25:24.171Z]]></design:creationdate> | ||
<design:modificationdate><![CDATA[2024-09-20T12:27:34.396Z]]></design:modificationdate> | ||
</extensionElements> | ||
<serviceTask id="bpmnTask_1" name="Get Weather Forecast" flowable:type="external-worker" flowable:topic="myTopic" flowable:exclusive="false"> | ||
<extensionElements> | ||
<flowable:externalWorkerInParameter source="city" target="city"></flowable:externalWorkerInParameter> | ||
<flowable:externalWorkerInParameter source="days" target="days"></flowable:externalWorkerInParameter> | ||
<flowable:externalWorkerInParameter sourceExpression="get_weather_forecast" target="__robocorpTaskName"></flowable:externalWorkerInParameter> | ||
<flowable:externalWorkerOutParameter source="temperature" target="temperature"></flowable:externalWorkerOutParameter> | ||
<design:stencilid><![CDATA[RobocorpTask]]></design:stencilid> | ||
<design:stencilsuperid><![CDATA[ExternalWorkerTask]]></design:stencilsuperid> | ||
</extensionElements> | ||
</serviceTask> | ||
<startEvent id="startnoneevent1" flowable:initiator="initiator" flowable:formFieldValidation="false"> | ||
<extensionElements> | ||
<flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation> | ||
<design:stencilid><![CDATA[StartNoneEvent]]></design:stencilid> | ||
</extensionElements> | ||
</startEvent> | ||
<endEvent id="bpmnEndEvent_3"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid> | ||
</extensionElements> | ||
</endEvent> | ||
<sequenceFlow id="bpmnSequenceFlow_4" sourceRef="bpmnTask_1" targetRef="bpmnEndEvent_3"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
<sequenceFlow id="bpmnSequenceFlow_2" sourceRef="startnoneevent1" targetRef="bpmnTask_1"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
</process> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_robocorpExample"> | ||
<bpmndi:BPMNPlane bpmnElement="robocorpExample" id="BPMNPlane_robocorpExample"> | ||
<bpmndi:BPMNShape bpmnElement="bpmnTask_1" id="BPMNShape_bpmnTask_1"> | ||
<omgdc:Bounds height="80.0" width="100.0" x="397.0" y="236.0"></omgdc:Bounds> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape bpmnElement="startnoneevent1" id="BPMNShape_startnoneevent1"> | ||
<omgdc:Bounds height="30.0" width="30.0" x="317.0" y="261.0"></omgdc:Bounds> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape bpmnElement="bpmnEndEvent_3" id="BPMNShape_bpmnEndEvent_3"> | ||
<omgdc:Bounds height="28.0" width="28.0" x="547.0" y="262.0"></omgdc:Bounds> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge bpmnElement="bpmnSequenceFlow_4" id="BPMNEdge_bpmnSequenceFlow_4" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0"> | ||
<omgdi:waypoint x="497.0" y="276.0"></omgdi:waypoint> | ||
<omgdi:waypoint x="547.0" y="276.0"></omgdi:waypoint> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge bpmnElement="bpmnSequenceFlow_2" id="BPMNEdge_bpmnSequenceFlow_2" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0"> | ||
<omgdi:waypoint x="347.0" y="276.0"></omgdi:waypoint> | ||
<omgdi:waypoint x="397.0" y="276.0"></omgdi:waypoint> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</definitions> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# read the contents of your README file | ||
from pathlib import Path | ||
|
||
from setuptools import setup | ||
|
||
this_directory = Path(__file__).parent | ||
long_description = (this_directory / "README.md").read_text() | ||
|
||
setup( | ||
name='flowable.robocorp-client', | ||
packages=['flowable', 'flowable.robocorp_client'], | ||
version='1.1.0rc1', | ||
description='Flowable client to be used with Robocorp. This client connects to a Flowable instance via external worker and executes robocorp tasks or actions.', | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
author='Flowable', | ||
license='Apache License, Version 2.0', | ||
install_requires=['flowable.external-worker-client>=1.1.0rc1', 'robocorp-actions>=0.2.1', 'robocorp-tasks>=3.1.1', 'robocorp-truststore>=0.9.1'], | ||
extras_require={ | ||
'testing': ['pytest', 'vcrpy'] | ||
}, | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters