
Security News
Static vs. Runtime Reachability: Insights from Latio’s On the Record Podcast
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
nestjs-zeebe
Advanced tools
A zeebe transport and client for NestJS 7.x
Using the zeebe-node module and exposing it as a NestJS transport and module.
npm install nestjs-zeebe
// app.module.ts
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { ZeebeModule, ZeebeServer } from 'nestjs-zeebe';
@Module({
imports: [ ZeebeModule.forRoot({ gatewayAddress: 'localhost:26500' })],
controllers: [AppController],
providers: [ZeebeServer],
})
export class AppModule {}
// main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ZeebeServer } from 'nestjs-zeebe';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const microservice = app.connectMicroservice({
strategy: app.get(ZeebeServer),
});
await app.startAllMicroservicesAsync();
await app.listen(3000);
}
bootstrap();
// app.controller.ts
import { Controller, Get, Inject } from '@nestjs/common';
import { AppService } from './app.service';
import { ZBClient } from 'zeebe-node';
import { ZEEBE_CONNECTION_PROVIDER, ZeebeWorker, ZeebeJob } from 'nestjs-zeebe';
import {
Ctx,
Payload,
} from '@nestjs/microservices';
import { ZBClient, ZBWorker, ICustomHeaders, IInputVariables, IOutputVariables, CompleteFn } from 'zeebe-node';
import { CreateProcessInstanceResponse } from 'zeebe-node/dist/lib/interfaces-grpc-1.0';
@Controller()
export class AppController {
constructor(private readonly appService: AppService, @Inject(ZEEBE_CONNECTION_PROVIDER) private readonly zbClient: ZBClient) {}
// Use the client to create a new workflow instance
@Get()
getHello() : Promise<CreateProcessInstanceResponse> {
return this.zbClient.createProcessInstance('order-process', { test: 1, or: 'romano'});
}
// Subscribe to events of type 'payment-service
@ZeebeWorker('payment-service')
paymentService(@Payload() job: ZeebeJob, @Ctx() context: { complete: CompleteFn<IOutputVariables>, worker: ZBWorker<IInputVariables, ICustomHeaders, IOutputVariables> }) {
console.log('Payment-service, Task variables', job.variables);
let updatedVariables = Object.assign({}, job.variables, {
paymentService: 'Did my job',
});
// Task worker business logic goes here
job.complete(updatedVariables);
}
// Subscribe to events of type 'inventory-service and create a worker with the options as passed below (zeebe-node ZBWorkerOptions)
@ZeebeWorker('inventory-service', { maxJobsToActivate: 10, timeout: 300 })
inventoryService(@Payload() job: ZeebeJob, @Ctx() context: { complete: CompleteFn<IOutputVariables>, worker: ZBWorker<IInputVariables, ICustomHeaders, IOutputVariables> }) {
console.log('inventory-service, Task variables', job.variables);
let updatedVariables = Object.assign({}, job.variables, {
inventoryVar: 'Inventory donnnneee',
});
// Task worker business logic goes here
//job.complete(updatedVariables);
job.complete(updatedVariables);
}
}
// app.controller.ts
import { Controller, Get, Inject } from '@nestjs/common';
import { AppService } from './app.service';
import { ZBClient } from 'zeebe-node';
import { CreateWorkflowInstanceResponse, CompleteFn, Job } from 'zeebe-node/interfaces';
import { ZEEBE_CONNECTION_PROVIDER, ZeebeWorker } from 'nestjs-zeebe';
import {
Ctx,
Payload,
} from '@nestjs/microservices';
@Controller()
export class AppController {
constructor(private readonly appService: AppService, @Inject(ZEEBE_CONNECTION_PROVIDER) private readonly zbClient: ZBClient) {}
// Use the client to create a new workflow instance
@Get()
getHello() : Promise<CreateWorkflowInstanceResponse> {
return this.zbClient.createWorkflowInstance('order-process', { test: 1, or: 'romano'});
}
// Subscribe to events of type 'payment-service
@ZeebeWorker('payment-service')
paymentService(@Payload() job, @Ctx() fn: CompleteFn<any> {
console.log('Payment-service, Task variables', job.variables);
let updatedVariables = Object.assign({}, job.variables, {
paymentService: 'Did my job',
});
// Task worker business logic goes here
complete.success(updatedVariables);
}
// Subscribe to events of type 'inventory-service and create a worker with the options as passed below (zeebe-node ZBWorkerOptions)
@ZeebeWorker('inventory-service', { maxJobsToActivate: 10, timeout: 300 })
inventoryService(@Payload() job, @Ctx() fn: CompleteFn<any>) {
console.log('inventory-service, Task variables', job.variables);
let updatedVariables = Object.assign({}, job.variables, {
inventoryVar: 'Inventory donnnneee',
});
// Task worker business logic goes here
complete.success(updatedVariables);
}
}
For mac, you need to have xcode installed
xcode-select --install
FAQs
Zeebe microservice module and client for nestjs
The npm package nestjs-zeebe receives a total of 648 weekly downloads. As such, nestjs-zeebe popularity was classified as not popular.
We found that nestjs-zeebe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.