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

Improve getting started experience for Camunda Cloud SaaS #132

Merged
merged 12 commits into from
Nov 19, 2021
134 changes: 134 additions & 0 deletions dmn-repo/risk_check_en.dmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:camunda="http://camunda.org/schema/1.0/dmn" id="definitions" name="definitions" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="4.10.0-nightly.20210831">
<decision id="checkRisk_en" name="Risk Check">
<decisionTable id="decisionTable" hitPolicy="COLLECT">
<input id="input1" label="Age" camunda:inputVariable="">
<inputExpression id="inputExpression1" typeRef="integer" expressionLanguage="feel">
<text>age</text>
</inputExpression>
</input>
<input id="InputClause_0sbc829" label="Employment">
<inputExpression id="LiteralExpression_0fpyor4" typeRef="string" expressionLanguage="feel">
<text>employment</text>
</inputExpression>
</input>
<input id="InputClause_0ohc5m6" label="Category" camunda:inputVariable="">
<inputExpression id="LiteralExpression_0o7difo" typeRef="string" expressionLanguage="feel">
<text>category</text>
</inputExpression>
</input>
<input id="InputClause_0g6gbjp" label="Score">
<inputExpression id="LiteralExpression_0zotgls" typeRef="integer" expressionLanguage="feel">
<text>score</text>
</inputExpression>
</input>
<output id="output1" label="Risk" name="risk" typeRef="string" />
<output id="OutputClause_0hh62nv" label="Risk Level" name="riskLevel" typeRef="string" />
<rule id="DecisionRule_09dgf3c">
<description></description>
<inputEntry id="UnaryTests_0ual6ir">
<text>&lt;= 30</text>
</inputEntry>
<inputEntry id="UnaryTests_1e397n3">
<text>-</text>
</inputEntry>
<inputEntry id="UnaryTests_0c3lrnz">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1l0btob">
<text>&lt;=85</text>
</inputEntry>
<outputEntry id="LiteralExpression_1f3y5xd">
<text>"Won't Pay In Time"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1w57ha5">
<text>"red"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0s72fjf">
<description></description>
<inputEntry id="UnaryTests_1dkokb9">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0d5r6v3">
<text>"Unemployed"</text>
</inputEntry>
<inputEntry id="UnaryTests_1v6fey5">
<text>not("Basic Package")</text>
</inputEntry>
<inputEntry id="UnaryTests_1rw2hjn">
<text>&lt;=95</text>
</inputEntry>
<outputEntry id="LiteralExpression_18kpqx8">
<text>"Lack Of Income"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0mrbkzr">
<text>"red"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0c99hq3">
<description></description>
<inputEntry id="UnaryTests_16q1ghi">
<text>&lt;= 30</text>
</inputEntry>
<inputEntry id="UnaryTests_0c86j25">
<text>"Self-employed"</text>
</inputEntry>
<inputEntry id="UnaryTests_0l8wmca">
<text>"Premium Package"</text>
</inputEntry>
<inputEntry id="UnaryTests_1qkgqif">
<text></text>
</inputEntry>
<outputEntry id="LiteralExpression_0jlpe55">
<text>"Irregular And Possibly Lack Of Income"</text>
</outputEntry>
<outputEntry id="LiteralExpression_05qilq2">
<text>"yellow"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1euaw2y">
<description></description>
<inputEntry id="UnaryTests_0bctfm4">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_12o8otd">
<text>"Freelancer", "Self-employed"</text>
</inputEntry>
<inputEntry id="UnaryTests_0o842fe">
<text>-</text>
</inputEntry>
<inputEntry id="UnaryTests_1h8e7id">
<text>&lt;=95</text>
</inputEntry>
<outputEntry id="LiteralExpression_1pwrw8z">
<text>"Not Trustworthy"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0zcjpew">
<text>"yellow"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_08nz8pq">
<description></description>
<inputEntry id="UnaryTests_0adgp9c">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1jzpweh">
<text>"Salaried"</text>
</inputEntry>
<inputEntry id="UnaryTests_17itih0">
<text>"Premium Package"</text>
</inputEntry>
<inputEntry id="UnaryTests_0dgmj4d">
<text>&lt;90</text>
</inputEntry>
<outputEntry id="LiteralExpression_1xwbye7">
<text>"Too Low Income"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1s5g29d">
<text>"yellow"</text>
</outputEntry>
</rule>
</decisionTable>
</decision>
</definitions>
Comment on lines +1 to +134
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ikheraj17 why do you want to add an example DMN to the repository?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that users immediately see the folder in which files have to go and also have a working example in case they are new to DMN.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saig0 Are there any other outstanding issues regarding my pull request? If not, would you or the appropriate person please merge the changes that Falko and I have made? I'm in the process of creating documentation for the Camunda Cloud showcase, and the showcase's DMN functionality depends on this plugin. Please let me know if there are any other changes that you have questions about. Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ikheraj17 I'm sorry for the delay. I was distracted by other duties 🙈

Currently, the build of this PR is failing. Something went wrong in the test case: WorkflowTest.shouldCompleteWorkflowInstance().

Error:  Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 34.072 s <<< FAILURE! - in io.zeebe.dmn.WorkflowTest
Error:  shouldCompleteWorkflowInstance  Time elapsed: 10.407 s  <<< ERROR!

Are you able to build the PR locally?
I'll look into it today or tomorrow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can reproduce the test error locally. Looking into it...

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,4 @@
<tag>HEAD</tag>
</scm>

</project>
</project>
2 changes: 1 addition & 1 deletion src/main/java/io/zeebe/dmn/DmnApplication.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2017 camunda services GmbH ([email protected])
* Copyright © 2017 camunda services GmbH ([email protected]).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/zeebe/dmn/DmnJobHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ public DmnJobHandler(DmnRepository repository, DmnEngine dmnEngine) {
public void handle(JobClient client, ActivatedJob job) {

final DmnDecision decision = findDecisionForTask(job);
System.out.println(decision);
final Map<String, Object> variables = job.getVariablesAsMap();

System.out.println(variables);
ikheraj17 marked this conversation as resolved.
Show resolved Hide resolved
final DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, variables);
System.out.println(decisionResult);

client
.newCompleteCommand(job.getKey())
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
zeebe:
client:
# cloud:
# clusterId: <YOUR_CLUSTER_ID>
# clientId: <YOUR_CLIENT_ID>
# clientSecret: <YOUR_CLIENT_SECRET>
worker:
defaultName: camunda-dmn-worker
defaultType: DMN
Expand All @@ -8,6 +12,7 @@ zeebe:
dmn.repository: dmn-repo

job.timeout: 10000
# remove the following two lines when using Camunda Cloud SaaS
broker.contactPoint: 127.0.0.1:26500
falko marked this conversation as resolved.
Show resolved Hide resolved
security.plaintext: true

Expand All @@ -20,3 +25,5 @@ logging:
management:
server:
port: 8081

server.port: 8082
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can remove this config and use the default port.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.