Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some obvious Typos in the README.md #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Using the zeebe-node module and exposing it as a NestJS transport and module.
// 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 { CreateWorkflowInstanceResponse, ZBClient } from 'zeebe-node';
import { CompleteFn, Job } from 'zeebe-node/interfaces';
import { ZEEBE_CONNECTION_PROVIDER, ZeebeWorker } from '@payk/nestjs-zeebe';
import {
Ctx,
Expand All @@ -68,39 +68,36 @@ Using the zeebe-node module and exposing it as a NestJS transport and module.

@Controller()
export class AppController {
constructor(private readonly appService: AppService, @Inject(ZEEBE_CONNECTION_PROVIDER) private readonly zbClient: ZBClient) {}
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'});
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> {
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',
paymentService: 'Did my job',
});

// Task worker business logic goes here

complete.success(updatedVariables);
job.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',
inventoryVar: 'Inventory donnnneee',
});

// Task worker business logic goes here

complete.success(updatedVariables);
job.complete.success(updatedVariables);
}
}

```