-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #333 from OlivierAlbertini/feature/add-aws-step-fu…
…nction-client feat: add aws step function client
- Loading branch information
Showing
175 changed files
with
4,726 additions
and
2,867 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,37 @@ | ||
{ | ||
"Comment": "A description of my state machine", | ||
"StartAt": "Activity", | ||
"States": { | ||
"Activity": { | ||
"Type": "Task", | ||
"Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken", | ||
"Parameters": { | ||
"MessageBody": { | ||
"body.$": "$", | ||
"properties": { | ||
"activityId": "sample_activity", | ||
"retries.$": "$$.State.RetryCount", | ||
"bpmnProcessId.$": "$$.StateMachine.Id", | ||
"jobKey.$": "$$.Task.Token", | ||
"workflowInstanceKey.$": "$$.Execution.Id" | ||
} | ||
}, | ||
"QueueUrl": "<YOUR QUEUE URL>" | ||
}, | ||
"End": true, | ||
"Retry": [ | ||
{ | ||
"ErrorEquals": [ | ||
"States.ALL" | ||
], | ||
"BackoffRate": 2, | ||
"IntervalSeconds": 1, | ||
"MaxAttempts": 5, | ||
"Comment": "Basic Retrier" | ||
} | ||
], | ||
"HeartbeatSeconds": 30, | ||
"TimeoutSeconds": 200 | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,24 +1,34 @@ | ||
/* | ||
* Copyright (c) 2023 Ville de Montreal. All rights reserved. | ||
* Copyright (c) 2024 Ville de Montreal. All rights reserved. | ||
* Licensed under the MIT license. | ||
* See LICENSE file in the project root for full license information. | ||
*/ | ||
|
||
// you can pass value here or an another (safer) way | ||
// process.env.AWS_REGION = 'us-east-1'; | ||
// process.env.AWS_ACCESS_KEY_ID = '<AWS_ACCESS_KEY_ID>'; | ||
// process.env.AWS_SECRET_ACCESS_KEY = '<AWS_SECRET_ACCESS_KEY>'; | ||
// process.env.AWS_SQS_WAIT_TIME_SECONDS = '20'; | ||
|
||
import { SERVICE_IDENTIFIER as CORE_IDENTIFIER, TAG } from '@villedemontreal/workit'; | ||
import { IoC } from '@villedemontreal/workit-core'; | ||
import { IWorkflowClient } from '@villedemontreal/workit-types'; | ||
|
||
(async (): Promise<void> => { | ||
const cm = IoC.get<IWorkflowClient>(CORE_IDENTIFIER.client_manager, TAG.camundaBpm); | ||
const platform = TAG.stepFunction; | ||
const cm = IoC.get<IWorkflowClient>(CORE_IDENTIFIER.client_manager, platform); | ||
for (let index = 0; index < 1; index += 1) { | ||
await cm.createWorkflowInstance({ | ||
bpmnProcessId: 'BPMN_DEMO', | ||
bpmnProcessId: | ||
platform === TAG.camundaBpm | ||
? 'BPMN_DEMO' | ||
: `arn:aws:states:${process.env.AWS_REGION}:<YOUR-AWS-ACCOUNT-ID>:stateMachine:Basic-Exemple`, | ||
variables: { | ||
amount: 1000, | ||
hello: 'world', | ||
}, | ||
}); | ||
} | ||
|
||
console.log('Success!'); | ||
console.info('Success!'); | ||
})(); |
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 |
---|---|---|
@@ -1,15 +1,44 @@ | ||
/* | ||
* Copyright (c) 2023 Ville de Montreal. All rights reserved. | ||
* Copyright (c) 2024 Ville de Montreal. All rights reserved. | ||
* Licensed under the MIT license. | ||
* See LICENSE file in the project root for full license information. | ||
*/ | ||
|
||
// you can pass value here or an another (safer) way | ||
// process.env.AWS_REGION = 'us-east-1'; | ||
// process.env.AWS_SQS_QUEUE_URL = '<SQS_QUEUE_URL>' | ||
// process.env.AWS_ACCESS_KEY_ID = '<AWS_ACCESS_KEY_ID>'; | ||
// process.env.AWS_SECRET_ACCESS_KEY = '<AWS_SECRET_ACCESS_KEY>'; | ||
// process.env.AWS_SQS_WAIT_TIME_SECONDS = '20'; | ||
|
||
import { SERVICE_IDENTIFIER as CORE_IDENTIFIER, TAG } from '@villedemontreal/workit'; | ||
import { IoC } from '@villedemontreal/workit-core'; | ||
import { IWorkflowClient } from '@villedemontreal/workit-types'; | ||
|
||
(async (): Promise<void> => { | ||
const cm = IoC.get<IWorkflowClient>(CORE_IDENTIFIER.client_manager, TAG.camundaBpm); | ||
const path = `${process.cwd()}/bpmn/BPMN_DEMO.bpmn`; | ||
await cm.deployWorkflow(path); | ||
console.log('Success!'); | ||
})(); | ||
import { IoC, Worker } from '@villedemontreal/workit-core'; | ||
import { HelloWorldTask } from '../tasks/helloWorldTask'; | ||
|
||
enum LOCAL_IDENTIFIER { | ||
sampleActivity = 'Get credit limit', | ||
} | ||
|
||
IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.sampleActivity); | ||
const worker = IoC.get<Worker>(CORE_IDENTIFIER.worker, TAG.stepFunction); | ||
|
||
const stop = (): void => { | ||
console.info('SIGTERM signal received.'); | ||
console.log('Closing worker'); | ||
worker | ||
.stop() | ||
.then(() => { | ||
console.log('worker closed'); | ||
process.exit(0); | ||
}) | ||
.catch((e: Error) => { | ||
console.log(e); | ||
process.exit(1); | ||
}); | ||
}; | ||
|
||
worker.start(); | ||
worker.run(); | ||
|
||
process.on('SIGINT', stop); | ||
process.on('SIGTERM', stop); |
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
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
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
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
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
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
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
Oops, something went wrong.