https://github.com/conductor-sdk/go-workers-patients-example
https://github.com/conductor-sdk/go-workers-patients-example
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/conductor-sdk/go-workers-patients-example
- Owner: conductor-sdk
- License: mit
- Created: 2023-11-15T20:56:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-16T18:39:16.000Z (over 2 years ago)
- Last Synced: 2023-11-22T19:30:22.744Z (over 2 years ago)
- Language: Go
- Size: 23.4 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-workers-patients-example
### Set environment variables
```
KEY
SECRET
CONDUCTOR_SERVER_URL
```
Make sure your application has permission to execute workflow,
poll and execute tasks.
The quickest way to set this up is to grant Unrestricted Worker,
Workflow Manager roles.
### Database setup
Workflow execution command is at the end of this document. Example input for the workflow execution specifies local postgres database `test` with user `postgres`,
no password, no SSL, `patients1` (meant to serve as local) and `patients2` tables (meant to serve as external) in `public` schema.
Run following commands from the command line:
```
createdb test
psql test
```
You should be logged into the test database via psql.
### Table setup for successful run:
Paste the following commands to setup the tables from the psql shell.
```
create table patients1 (
first_name text,
last_name text,
dob date,
family_doctor_assigned bool
);
create table patients2 (
first_name text,
last_name text,
dob date,
family_doctor_assigned bool
);
INSERT INTO patients1 VALUES ('John', 'Smith', '1983-05-21'::date, false);
INSERT INTO patients2 VALUES ('John', 'Smith', '1983-05-21'::date, true);
```
### Run the Application
Navigate to the root of the cloned repository and run the following command
```
cd src
go build -o patients
./patients
```
### Workflow Setup
Make sure this workflow definition is added to your Orkes instance if not testing on the Playground - https://play.orkes.io/workflowDef/PatientWorkflow/1.
### Trigger the workflow
```
curl -X POST localhost:8083/ --data '{"localTable":"patients1","externalTable":"patients2","dob":"1983-05-21","LocalDBConnectionString":"user=postgres dbname=test host=localhost sslmode=disable","last_name":"Smith","first_name":"John","ExternalDBConnectionString":"user=postgres dbname=test host=localhost sslmode=disable"}'
```
The above command should result in a successfult workflow execution of the PatientWorkflow similar to https://play.orkes.io/execution/ffe5f01d-83fb-11ee-b9e2-3e6b0496d0cf?tab=diagram.