Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tasso94/nestjs-cambpm
Run your business logic anywhere.
https://github.com/tasso94/nestjs-cambpm
camunda nestjs nodejs workflow workflow-automat
Last synced: about 2 months ago
JSON representation
Run your business logic anywhere.
- Host: GitHub
- URL: https://github.com/tasso94/nestjs-cambpm
- Owner: tasso94
- License: apache-2.0
- Created: 2020-08-12T07:32:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-16T04:04:14.000Z (about 3 years ago)
- Last Synced: 2024-10-14T20:37:30.947Z (2 months ago)
- Topics: camunda, nestjs, nodejs, workflow, workflow-automat
- Language: TypeScript
- Homepage:
- Size: 911 KB
- Stars: 17
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NestJS Connector for Camunda BPM Runtime
> Run your business logic anywhere
## Install
```
npm i nestjs-cambpm
```## Example
The full example can be found [here]. Please also see the [Azure Function Example].
[here]: https://github.com/tasso94/nestjs-cambpm/tree/master/examples/local-microservice
[Azure Function Example]: https://github.com/tasso94/nestjs-cambpm/tree/master/examples/azure-microservice```typescript
// src/main.tsasync function bootstrap() {
const app = await NestFactory.create(AppModule);
app.connectMicroservice({
strategy: app.get(ExternalTaskConnector),
});await app.startAllMicroservicesAsync();
}
bootstrap();
``````typescript
// src/app.module.ts@Module({
controllers: [AppController],
providers: [
ExternalTaskConnector,
ExternalTaskModule.createClient({
baseUrl: 'http://localhost:8080/engine-rest',
}),
],
})
export class AppModule {}
``````typescript
// src/app.controller.ts@Controller()
export class AppController {
@Subscription('my-external-task', {
lockDuration: 500,
})
async myExternalTask(@Payload() task: Task, @Ctx() taskService: TaskService) {
const businessKey = task.businessKey;
const isBusinessKeyMissing = !businessKey;const processVariables = new Variables();
processVariables.set('isBusinessKeyMissing', isBusinessKeyMissing);if (!isBusinessKeyMissing) {
// Complete the External Task
await taskService.complete(task, processVariables);
Logger.log('External task successfully completed!');} else {
const errorMessage = 'No business key given!';
const options: HandleFailureOptions = {
errorMessage: errorMessage,
};// Raise an incident
await taskService.handleFailure(task, options);Logger.error(errorMessage);
}
}
}
```