Skip to content

Instantly share code, notes, and snippets.

@evacchi
evacchi / drools.java
Created June 28, 2021 09:50
jbang drools.java (improved)
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 16
//REPOS jitpack=https://jitpack.io/
//DEPS com.github.evacchi:drools-jbang-starter:main-SNAPSHOT
// example
// jbang <url> '{ "name":"Mario", "age":40 }' '{ "name":"Mark", "age":37 }'
package org.kie.example;
@evacchi
evacchi / drools.java
Created June 26, 2021 12:24
jbang drools.java
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.drools:drools-engine:7.56.0.Final
//DEPS org.drools:drools-mvel:7.56.0.Final
//DEPS org.drools:drools-mvel:7.56.0.Final
//DEPS org.slf4j:slf4j-nop:1.7.31
//DEPS com.fasterxml.jackson.core:jackson-databind:2.12.3
// example
// jbang <url> '{ "name":"Mario", "age":40 }' '{ "name":"Mark", "age":37 }'
@evacchi
evacchi / my-process.bpmn
Created March 5, 2021 08:25
my-process.bpmn
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_P72zYV-6EDmrSITuK2tOlw" exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20">
<bpmn2:itemDefinition id="_nameItem" structureRef="String"/>
<bpmn2:itemDefinition id="_ageItem" structureRef="Integer"/>
<bpmn2:process id="my-process" drools:packageName="com.example" drools:version="1.0" drools:adHoc="false" name="my-process" isExecutable="true" processType="Public">
<bpmn2:property id="name" itemSubjectRef="_nameItem" name="name"/>
<bpmn2:property id="age" itemSubjectRef="_ageItem" name="age"/>
<bpmn2:sequenceFlow id="_A627D26C-DD92-4175-8372-77E98C7E4BD7" sourceRef="_BB7258FB-435F-447F-B52D-54D78D00F8D4" targetRef="_23D28193-C2
@evacchi
evacchi / kogito-compile.bpmn
Created November 24, 2020 17:28
kogito-compile.bpmn
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" id="_ZuzqIBCoEDmto_Ey_YjStg" exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20"><bpmn2:process id="new-file" drools:packageName="com.example" xmlns:drools="http://www.jboss.org/drools" drools:version="1.0" drools:adHoc="false" name="new-file" isExecutable="true" processType="Public"><bpmn2:laneSet><bpmn2:lane id="_28260E1B-F382-425C-93C7-7CB69D5E6A76" name="Run-Time"><bpmn2:extensionElements><drools:metaData name="elementname"><drools:metaValue>Run-Time</drools:metaValue></drools:metaData></bpmn2:extensionElements><bpmn2:flowNodeRef>_73A13B6B-79C6-41F5-8ACA-6255417C0C56</bpmn2:flowNodeRef><bpmn2:flowNodeRef>_5D436B8C-78AD-4197-B1C2-F57854522963</bpmn2:flowNodeRef><bpmn2:flowNodeRef>_70D0E608-2FAB-4771-8E8A-D56E55ECECD0</bpmn2:flowNodeRef><bpmn2:flowNodeRef>_D0B70221-D3EA-4B10-91CC-F8A052F3951C</bpmn2:flowNodeRef><bpmn2:flowNodeRef>_9042F879-7EA3-424
@evacchi
evacchi / Main.java
Created July 2, 2020 07:22
Fancy Java Main
package com.mycompany.app;
public class Main extends Application {{
System.out.println("Hello");
}}
abstract class Application {
public static void main(String... args) throws Exception {
Class.forName(System.getProperty("sun.java.command"))
.getConstructor().newInstance();
@evacchi
evacchi / kogito-compose.yaml
Created February 17, 2020 14:31
Kogito Docker Compose Minimal
version: '2'
services:
infinispan:
image: infinispan/server:10.0.0.Final-1
ports:
- 11222:11222
command: "/opt/infinispan/bin/server.sh -c infinispan-demo.xml"
volumes:
@evacchi
evacchi / kogito-hackaton.md
Last active February 12, 2020 09:04
Kogito Milano Hackaton

I have set up a repository https://github.com/evacchi/kogito-travel-agency-tutorial with yet-another fork of Maciej's demo. I have upgraded kogito and quarkus to the latest version.

You will try two versions of the tutorial; one will run completely on your local machine. The other can run locally, but it would be more interesting if you tried it on OpenShift.

01-kogito-travel-agency

try this demo.

mvn compile quarkus:dev

@evacchi
evacchi / AlertingService.drl.java
Last active January 24, 2020 09:35
Drools: Declared Types (Blog)
package com.acme;
unit AlertingService;
rule IncomingEvent when
// matches when a temperature higher than 30 °C is registered (OOPath syntax)
$e : /events [ type == "temperature", value >= 30 ] // Temperature is an Event subclass
then
System.out.println("incoming event: "+ $e.getMessage());
alerts.append( new Alert( "warning", $e ) );
end
@evacchi
evacchi / install-kogito-extension.sh
Last active February 11, 2020 08:29
Install Kogito Extension
#!/bin/sh
curl -L https://github.com/kiegroup/kogito-tooling/releases/download/0.2.7/kiegroup_kogito_vscode_extension_0.2.7.vsix -o kogito.vsix
code --install-extension kogito.vsix
apiVersion: kafka.strimzi.io/v1beta1
kind: KafkaTopic
metadata:
name: kogito-processinstances-events
labels:
strimzi.io/cluster: my-cluster
namespace: kogito
spec:
partitions: 10
replicas: 3