thhermansen / zeebe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prerequisite

  • brew cask install zeebe-modeler

Example app

kubectl port-forward svc/zeebe-cluster-zeebe-gateway 26500:26500 -n zeebe-thorbjorn # Run in a terminal of it's own

cd app

bin/worker # Run in a terminal of it's own
bin/console

Order

import {Duration} from 'zeebe-node'
import OrderWorkflow from '@workflows/orderPlaced'

// Will be a success :-)
let orderId = 1
OrderWorkflow.orderPlaced({orderId, country: 'Norway'})
OrderWorkflow.client.publishMessage({ name: 'paymentReceived', correlationKey: orderId.toString(), timeToLive: Duration.seconds.of(60), variables: {receivedAmount: 100} })

// Will fail, payment issue
orderId = 2
OrderWorkflow.orderPlaced({orderId, country: 'Norway'})

// Change order id to 3, just to make it pass
OrderWorkflow.client.publishMessage({ name: 'paymentReceived', correlationKey: '3', timeToLive: Duration.seconds.of(60), variables: {receivedAmount: 100} })

// Show business error, sending is too large
orderId = 5
OrderWorkflow.orderPlaced({orderId, country: 'sweden'})
OrderWorkflow.client.publishMessage({ name: 'paymentReceived', correlationKey: orderId.toString(), timeToLive: Duration.seconds.of(60), variables: {receivedAmount: 100} })

OCR registration

import {Duration} from 'zeebe-node'
import NetsOcrRegistration from '@workflows/netsOcrRegistration'

let accountNumber = 1
NetsOcrRegistration.schedule(accountNumber)

NetsOcrRegistration.client.publishMessage({name: 'netsOcrAgreementPollStatusNow', correlationKey: accountNumber.toString(), timeToLive: Duration.seconds.of(60), variables: {} })

OCR Poll

import {Duration} from 'zeebe-node'
import NetsOcrPollFiles from '@workflows/netsOcrPollFiles'

NetsOcrPollFiles.client.publishMessage({name: 'netsOcrPollFilesStart', correlationKey: 'pollJobSameKeyEnsuresSingleInstance', timeToLive: Duration.seconds.of(60), variables: {numberOfFiles: 0} })

NetsOcrPollFiles.client.publishMessage({name: 'netsOcrPollFilesStart', correlationKey: 'pollJobSameKeyEnsuresSingleInstance', timeToLive: Duration.seconds.of(60), variables: {numberOfFiles: 2} })

// File number 5, 6 and 7 will cause issue in parent process
NetsOcrPollFiles.client.publishMessage({name: 'netsOcrPollFilesStart', correlationKey: 'pollJobSameKeyEnsuresSingleInstance', timeToLive: Duration.seconds.of(60), variables: {numberOfFiles: 7} })

Resources

TODO

  • HELM charts has some tests running, which .. I'm not sure how is suppose to work, but I do want to not include them in the deploy.
  • Make a test app to play with
  • Test more advanced use cases like subprocesses, errro handling etc.

Questions

About


Languages

Language:TypeScript 98.2%Language:Shell 1.8%