camunda

Bismillah
1) camunda

--
https://docs.camunda.org/get-started/quick-start/?__hstc=252030934.fdedad24f900b0469e1cbbf05fdf49ab.1547695067134.1547695067134.1547695067134.1&__hssc=252030934.3.1547695067134&__hsfp=1188821749
https://docs.camunda.org/get-started/quick-start/service-task/

1)line break
shift + enter
2)new bmpn diagram
3) start event
4) double click to edit label
5) right click, context menu
select activity shape(rectangle)
6) canvas
$ drag it to preferred position
$ activity type : service task
click on the activyt shape, using wrench button
$ end event
$ send task, receive task, user task
manual task
business rule task
service task
script task
call activity
sub process(collapsed)
sub process(expanded)

$ thick circle -> end event
$ configure the service task
execute ways
 external task pattern
  open properties panel
    implementation: External
    Topic: charge-card
$ executable true, false: ignored by process engine
$ empty space on modeling canvas
properties of process itself
$ configure
ID = payment-retrieval
used by process engine  as indentifier for executable process
human readablename
name = Payment Retrieval

$ File > Save File As..
payment.bpmn

$ implement an external task worker
after modeling the process, we want to
execute some business logic
$ business logican can be implemented in
different languages

$ Camunda ready-to-go task clients
java, javascript(Node js), Camunda REST Api
$ never worked java, prefer javascript

$ using java

jdk1.8, eclipse

$ maven dependency to external task client for new process application



 org.camunda.bpm
 camunda-externa-task-client
 1.0.0

 $Long polling in External TaskClient

 external task instace

 $
 ExternalTaskClient client = ExternalTaskClient.create()
  .baseUrl("http://localhost:8080/engine-rest")
  .asyncResponseTimeout(10000)
  .build()

client.subscribe("charge-card")
.lockDuration(1000)
.handler((externalTask, externalTaskService) -> {
// put your business logic service

// Get a process variable
String item = (String) externalTask.getVariable("item");
Long amount = (Long) externalTask.getVariable("amount");

// complete the task
externalTaskService.complete(externalTask)
})
.open();
---
Using javascript(NodeJs)
NodeJs > v8.9.4
editor: Atom

mkdir charge-card-worker
cd ./charge-card-worker
npm init -y

npm install -s camunda-external-task-client-js

worker.js
---
const { Client, logger} = require('camunda-external-task-client-js');

const config = { baseUrl: 'http://localhost:8080/engine-rest', use: logger, asyncResponseTimeout: 10000 };

const client = new Client(config);

client.subscribe('charge-card', async function({ task, taskService }) {
//put your business logic here

// get a process variable
const amount = task.variables.get('amount');
const item = task.variables.get('amount');

console.log(`charge credit card with an amount of ${amount}$ for the item '${item}...');

// complete the task
await taskService.complete(task);
});

---
node ./worker.js

---
use the camunda modeler to deploy the process
deploy buttoon
deployment name: "Payment Retrieval"
---
verify the deployment with cockpit

http://localhost:8080/camunda/app/cockpit
login credentials: demo/demo
---
start a process instance

curl or rest client
post http://localhost:8080/engine-rest/process-definition/key/payment-retrieval/start

{
"variables" :{
"amount" : {
"value" : 555,
"type" : "long"
},
"item" :{
  "value": "item-xyz"
}
}
}

Content-Type: application/json

---
Add a user task to the process
https://docs.camunda.org/get-started/quick-start/user-task/

modeler left-hand menu,
select the activity shape(rectangle)
drag it into position between the start event
and "Charge Crdit Card" service task
- Name it "Approve Payment"
- change activity type: User task
  - by clicking on it
  - using the wrench button menu
    - User Task
---
Configure a User Task
 Assignee: demo

Configure basic form in user Task
 "Properties Panel"
 Forms tab
 3 form fields
    clicking on plus button 3 times
    field1:
      ID: amount
      Type: long
      Label: Amount
    field 2:
     Id: item
     Type: string
     Label: Item
    field 3:
     Id:approved
     Type: boolean
     Label: Approved?

deploy the process
  deploy button

---
work on the task
http://localhost:8080/camunda/app/tasklist
 credentials demo/demo
 click on start process button
 select Payment Retrieval from the list
 set variables for process instance using egeneric form

 click start

 approve payment task in your task list
 se;ect tasl
 click on the diagram
   highlight user task thats waiting to be worked on

 form tab
 ---



https://camunda.com/learn/videos/

https://vimeo.com/235713307
 - Camunda Basics Get Started

Camunda for Java Developers
 https://vimeo.com/235728986
 --
 BPMN Deep Dive
 https://vimeo.com/235729360
Watch now: Get to know the more advanced BPMN symbols and how to execute them.

process communicaton
https://vimeo.com/294101913
---
error handling
https://vimeo.com/294099860
---
https://forum.camunda.org/?__hstc=252030934.fdedad24f900b0469e1cbbf05fdf49ab.1547695067134.1547695067134.1547695067134.1&__hssc=252030934.2.1547699325736&__hsfp=1188821749
---
https://docs.camunda.org/manual/7.10/?__hstc=252030934.fdedad24f900b0469e1cbbf05fdf49ab.1547695067134.1547695067134.1547695067134.1&__hssc=252030934.3.1547699325736&__hsfp=1188821749
---
https://camunda.com/learn/webinars/

No comments:

Post a Comment