The document provides an overview of key features and internals of the Drools 6 rule engine, including:
- The Phreak algorithm, which is faster than ReteOO and uses set-based propagation for improved performance on large data sets.
- The deployment model which uses kjar modules that are self-contained, versioned JAR files containing rules, models, and configuration. This allows for incremental compilation and use of the KieScanner for automatic updates.
- Changes to type declarations which are now compiled into the kjar, allowing them to be used directly in Java code without reflection.
NestJS (https://nestjs.com/) is a Node.js framework for building server-side applications. This slide give you a brief introduction of Nest, and shows the examples like Service, Middleware, and Pipe, etc.
Presented at Web Unleashed on September 16-17, 2015 in Toronto, Canada
More info at www.fitc.ca/webu
Why TypeScript?
with Jeff Francis
OVERVIEW
TypeScript is a type-checked superset of JavaScript that benefits medium-sized to complex JavaScript projects. Why would you want to learn a new language, instead of another JavaScript framework? You have all this existing JavaScript code, so how can you adopt something new without throwing the old stuff out?
This session is about the benefits of using TypeScript on top of JavaScript in your projects, and demonstrate step by step ways of migrating an existing JavaScript project to TypeScript. We will dive into code generated by the compiler and look at resources and tools that make working in TypeScript a pleasurable experience.
OBJECTIVE
To understand when it’s a good idea to use TypeScript.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
Intermediate JavaScript experience.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
The basics of TypeScript – types, classes, modules, and functions
How TypeScript’s design makes getting started simple and helps projects
What compiled TypeScript looks like and how to debug
What tools can help take advantage of TypeScript’s type information
How to migrate a JavaScript project to TypeScript
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
Find out why more and more developers are switching to Git - distributed version control. This intro to Git covers the basics, from cloning to pushing for beginners.
NestJS (https://nestjs.com/) is a Node.js framework for building server-side applications. This slide give you a brief introduction of Nest, and shows the examples like Service, Middleware, and Pipe, etc.
Presented at Web Unleashed on September 16-17, 2015 in Toronto, Canada
More info at www.fitc.ca/webu
Why TypeScript?
with Jeff Francis
OVERVIEW
TypeScript is a type-checked superset of JavaScript that benefits medium-sized to complex JavaScript projects. Why would you want to learn a new language, instead of another JavaScript framework? You have all this existing JavaScript code, so how can you adopt something new without throwing the old stuff out?
This session is about the benefits of using TypeScript on top of JavaScript in your projects, and demonstrate step by step ways of migrating an existing JavaScript project to TypeScript. We will dive into code generated by the compiler and look at resources and tools that make working in TypeScript a pleasurable experience.
OBJECTIVE
To understand when it’s a good idea to use TypeScript.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
Intermediate JavaScript experience.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
The basics of TypeScript – types, classes, modules, and functions
How TypeScript’s design makes getting started simple and helps projects
What compiled TypeScript looks like and how to debug
What tools can help take advantage of TypeScript’s type information
How to migrate a JavaScript project to TypeScript
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
Find out why more and more developers are switching to Git - distributed version control. This intro to Git covers the basics, from cloning to pushing for beginners.
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
Building an enterprise level single sign-on application with the help of keycloak (Open Source Identity and Access Management).
And understanding the way to secure your application; frontend & backend API’s. Managing user federation with minimum configuration.
[Session given at Engage 2019, Brussels, 15 May 2019]
In this session, Tim Davis (Technical Director at The Turtle Partnership Ltd) takes you through the new Domino Query Language (DQL), how it works, and how to use it in LotusScript, in Java, and in the new domino-db Node.js module. Introduced in Domino 10, DQL provides a simple, efficient and powerful search facility for accessing Domino documents. Originally only used in the domino-db Node.js module, with 10.0.1 DQL also became available to both LotusScript and Java. This presentation will provide code examples in all three languages, ensuring you will come away with a good understanding of DQL and how to use it in your projects.
Slides from the NestJS MasterClass.
We learned how to build JavaScript server-side applications with NestJS - A progressive NodeJS framework built with TypeScript.
You can find the code on GitHub:
https://github.com/nirkaufman/task-manager
A walkthrough the main principles to reach solid NodeJS Applications with TypeScript language, Jest as Test Runner and NestJS as framework for structure.
The presentation explains how to setup rate limits, how to work with 429 code, how rate limits are implemented in kubernetes, cni, loadbalancer and so on
Kube Overview and Kube Conformance Certification OpenSource101 RaleighBrad Topol
This is my Introduction to Kubernetes and Overview of the Kubernetes Conformance Certification Program talk presented at OpenSource101 Raleigh on Feb 17, 2018
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
Building an enterprise level single sign-on application with the help of keycloak (Open Source Identity and Access Management).
And understanding the way to secure your application; frontend & backend API’s. Managing user federation with minimum configuration.
[Session given at Engage 2019, Brussels, 15 May 2019]
In this session, Tim Davis (Technical Director at The Turtle Partnership Ltd) takes you through the new Domino Query Language (DQL), how it works, and how to use it in LotusScript, in Java, and in the new domino-db Node.js module. Introduced in Domino 10, DQL provides a simple, efficient and powerful search facility for accessing Domino documents. Originally only used in the domino-db Node.js module, with 10.0.1 DQL also became available to both LotusScript and Java. This presentation will provide code examples in all three languages, ensuring you will come away with a good understanding of DQL and how to use it in your projects.
Slides from the NestJS MasterClass.
We learned how to build JavaScript server-side applications with NestJS - A progressive NodeJS framework built with TypeScript.
You can find the code on GitHub:
https://github.com/nirkaufman/task-manager
A walkthrough the main principles to reach solid NodeJS Applications with TypeScript language, Jest as Test Runner and NestJS as framework for structure.
The presentation explains how to setup rate limits, how to work with 429 code, how rate limits are implemented in kubernetes, cni, loadbalancer and so on
Kube Overview and Kube Conformance Certification OpenSource101 RaleighBrad Topol
This is my Introduction to Kubernetes and Overview of the Kubernetes Conformance Certification Program talk presented at OpenSource101 Raleigh on Feb 17, 2018
In this talk, a closer look into the lifecycle of operators will be presented. With an understanding of how operators evolve, it becomes clear what
challenges during operator upgrades. A brief overview of lifecycle management tools such as Helm, OLM, and Carvel is presented in this context. In particular, it will be discussed whether these tools can help, which restrictions apply and where further development would be desirable.
At the end of this talk, you will know what operator lifecycle management is about, what its challenges are, and which tools may be used to reduce operational friction.
This talk was given by Julian Fischer for DoK Day Europe @ KubeCon 2022.
Link: https://youtu.be/_lQhoCUQReU
https://go.dok.community/slack
https://dok.community/
From the DoK Day EU 2022 (https://youtu.be/Xi-h4XNd5tE)
The ability to extend Kubernetes with Custom Resource Definitions and respective controllers has led to the OperatorSDK, which became
the de facto standard for data service automation on Kubernetes. There are countless operator implementations available, and new operators are
being released on a daily basis. Organizations managing hundreds of Kubernetes clusters for dozens of developer teams are also challenged to
manage the lifecycle of hundreds of Kubernetes operators. The goal is to keep the operational overhead to a minimum.
In this talk, a closer look into the lifecycle of operators will be presented. With an understanding of how operators evolve, it becomes clear what
challenges during operator upgrades. A brief overview of lifecycle management tools such as Helm, OLM, and Carvel is presented in this context. In particular, it will be discussed whether these tools can help, which restrictions apply and where further development would be desirable.
At the end of this talk, you will know what operator lifecycle management is about, what its challenges are, and which tools may be used to reduce operational friction.
-----
Julian Fischer, CEO of anynines, has dedicated his career to the automation of software operations. In more than fifteen years, he has built several application platforms. He has been using Kubernetes, Cloud Foundry, and BOSH in recent years. Within platform automation, Julian has a strong focus on data service automation at scale.
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeAcademy
One of the most underrated features of Kubernetes is namespaces. In the market, instead of using this feature, people are still stuck with having different clusters for their environments. This talk will try to break this approach, and will introduce how we end up using ephemeral namespaces within our CI/CD pipeline. It will cover the architecture of our system for running the user acceptance tests on isolated ephemeral namespaces with every bits and pieces running within pods. While doing this, we will set up our CI/CD pipeline on top of TravisCI, GoCD, and Selenium that is controlled by Nightwatch.js.
Sched Link: http://sched.co/6Bcb
A Series of Fortunate Events: Building an Operator in JavaVMware Tanzu
SpringOne 2021:
Session Title: A Series of Fortunate Events: Building an Operator in Java
Speakers: Alberto C. Ríos, Staff Engineer at VMware; Bella Bai, Software Engineer at VMware
The wrong assumptions and choices can undermine your move to Kubernetes. Instructions on how to implement and scale Kubernetes abounds. What’s missing from these discussions? How do you make developers be super-productive on Kubernetes? Based on lessons gleaned from both large organizations (Netflix, Uber), mid-sized (Yelp, HubSpot), and small, Richard and Rafael discuss the key steps these organizations took to optimize their developers’ productivity as they migrated to Kubernetes.
JDD2015: Kubernetes - Beyond the basics - Paul BakkerPROIDEA
KUBERNETES - BEYOND THE BASICS
Kubernetes has answers to many questions related to clustering and the required low-level networking. When using Kubernetes for real live deployments we need more than those lower-level solutions however. We need things like automated deployments, load balancing for web applications, blue/green deployments and monitoring.
This is all possible with Kubernetes when we start to look at Kubernetes as an API. In this talk you will learn to embrace the Kuberentes API and some of the patterns, tools and mechanisms we developed and use around Kubernetes to prepare for production grade deployments.
Project Gardener - EclipseCon Europe - 2018-10-23msohn
Open Source project Gardener (https://gardener.cloud) is a production-grade Kubernetes-as-a-Service management tool that works across various cloud-platforms (e.g, AWS, Azure, GCP, Alibaba & SAP Datacenters) and on-premise (e.g. with OpenStack)
Kubernetes is an open-source system and is quickly becoming the new standard for automating deployment, scaling, and management of containerized applications.
In the presentation we will have a high-level overview of the most important components of Kubernetes and how they fit together. We will start with having an overview of Container and Orchestration and what Kubernetes is capable of and how it helps in automating deployment and scaling software in the cloud. Afterwards we will discuss Kubernetes objects (Pod, ReplicaSet, Deployment, Services, Namespaces) with some examples.
Let's make a contract: the art of designing a Java APIMario Fusco
An API is what developers use to achieve some task. More precisely it establishes a contract between them and the designers of the software exposing its services through that API. In this sense we're all API designers: our software doesn't work in isolation, but becomes useful only when it interacts with other software written by other developers. When writing software we're not only consumers, but also providers of one or more API and that's why every developer should know the features of a good API. During this presentation we will go through real-world examples, also taken from the standard Java API, of good and bad API and comment them in order to show the dos and don'ts of API design. More in general we will discuss the characteristics of an easy and pleasant to use API, like consistency, discoverability and understandability, together with some basic concepts like the principle of least astonishment, and find out how to achieve them.
OOP and FP - Become a Better ProgrammerMario Fusco
The story of Simon, an experienced OOP Java developer, exposed to the new lambda features of JDK 8. His friend Mario, a long-bearded FP geek, will try to convince him that FP can help him develop more readable and maintainable code. A journey into the discovery of the main new feature - lambda expressions - of JDK 8
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
1. Drools 6 Deep Dive
(Core Engine)
Mario Fusco
mfusco@redhat.com
Senior Software Engineer
Edson Tirelli
etirelli@redhat.com
Drools Project Lead
Principal Software Engineer
2. Drools 6 Deep Dive
● Core Engine Internals
Phreak Algorithm (and ReteOO comparison)
Set based propagation
● Deployment model
Kjar modules
Incremental compilation and KieScanner
Type declarations changes from Drools 5
● Most useful less known features
Property reactivity
Backward chaining
Multi-function accumulates
Conditional named consequences
4. ReteOO was cool
● Node Sharing
● Alpha Indexing
● Tree-based graphs
● Modify-in-place
● Property reactive
● Sub-networks for nested CEs
● Backward chaining support
● Lazy Truth Maintenance
● Heap based agenda
● Dynamic Rules support
5. But Phreak is better
● New algorithm:
Inspired by Rete, LEAPS, Collection Oriented Match, L/R
Unlinking
● Preserves all ReteOO optimizations (that still make sense)
● Adds a whole new level of innovations:
Full rule and segment unlinking
Lazy evaluation, rule scoping
Set-based propagation
● Results:
On average, 20% faster than ReteOO*
On specific use cases, up to 400% faster
Reduced memory footprint
More forgiving algorithm to badly written rules
* see the Drools blog for details
11. Why set-based propagation
● For large amounts of data, the number of tuples that
match individual conditions is likely to be large
● In such situations, the number of collections will be much
smaller than the number of tuples
● Collections of tuples that match individual conditions are
the unit of matching, rather than individual tuples
● Tame the combinatorial explosion, since it generates
combinations of collections instead of combinations of
tuples
24. Incremental Compilation
KieServices ks = KieServices.Factory.get();
ReleaseId rel1 = ks.newReleaseId( "org.mycompany", "myproject", "1.0.0" );
// creates a KieContainer for the project identified by rel1
KieContainer kc = ks.newKieContainer( rel1 );
// instance the default KieSession from the KieContainer ...
KieSession ksession = kc.newKieSession();
// … and do some work on that KieSession
// programmatically upgrade the KieContainer to a newer version
ReleaseId rel2 = ks.newReleaseId( "org.mycompany", "myproject", "1.1.0" );
kc.updateToVersion( rel2 );
// the rule base used by the KieSession is dynamically updated
// so you can keep using the same KieSession instance with newer rules
KieServices ks = KieServices.Factory.get();
ReleaseId rel1 = ks.newReleaseId( "org.mycompany", "myproject", "1.0.0" );
// creates a KieContainer for the project identified by rel1
KieContainer kc = ks.newKieContainer( rel1 );
// instance the default KieSession from the KieContainer ...
KieSession ksession = kc.newKieSession();
// … and do some work on that KieSession
// programmatically upgrade the KieContainer to a newer version
ReleaseId rel2 = ks.newReleaseId( "org.mycompany", "myproject", "1.1.0" );
kc.updateToVersion( rel2 );
// the rule base used by the KieSession is dynamically updated
// so you can keep using the same KieSession instance with newer rules
25. KieScanner
● Allows continuous monitoring of your Maven repository to
check whether a new release of a Kie project is available
● When it finds a newer version of the project used by the
KieContainer on which it has been registered, automatically
downloads it and triggers an incremental build
● Can be configured to run with a fixed time interval, but it is
also possible to run it on demand
KieServices kieServices = KieServices.Factory.get();
ReleaseId releaseId = kieServices.newReleaseId( "org.mycompany",
"myproject",
"LATEST" );
KieContainer kContainer = kieServices.newKieContainer( releaseId );
KieScanner kScanner = kieServices.newKieScanner( kContainer );
// Start the KieScanner polling the Maven repository every 10 seconds
kScanner.start( 10000L );
KieServices kieServices = KieServices.Factory.get();
ReleaseId releaseId = kieServices.newReleaseId( "org.mycompany",
"myproject",
"LATEST" );
KieContainer kContainer = kieServices.newKieContainer( releaseId );
KieScanner kScanner = kieServices.newKieScanner( kContainer );
// Start the KieScanner polling the Maven repository every 10 seconds
kScanner.start( 10000L );
Use maven
version range
27. In Drools5 typedeclarationswerecompiled at
runtime
package org.mypackage
declare Person
name : String
age : int
end
rule "Find adults" when
Person( age > 18,
$name : name )
then
System.out.println( $name );
end
package org.mypackage
declare Person
name : String
age : int
end
rule "Find adults" when
Person( age > 18,
$name : name )
then
System.out.println( $name );
end
// a knowledge base with a declared type:
KieBase kbase = ...
// get the declared FactType
FactType personType =
kbase.getFactType( "org.mypackage",
"Person" );
// handle the type as necessary:
// create instances:
Object bob = personType.newInstance();
// set attributes values
personType.set( bob, "name", "Bob" );
personType.set( bob, "age", 42 );
// insert fact into a session
KieSession ksession = ...
ksession.insert( bob );
ksession.fireAllRules();
// a knowledge base with a declared type:
KieBase kbase = ...
// get the declared FactType
FactType personType =
kbase.getFactType( "org.mypackage",
"Person" );
// handle the type as necessary:
// create instances:
Object bob = personType.newInstance();
// set attributes values
personType.set( bob, "name", "Bob" );
personType.set( bob, "age", 42 );
// insert fact into a session
KieSession ksession = ...
ksession.insert( bob );
ksession.fireAllRules();
Type declarations can
be used in Java code
only via reflection
28. In Drools6 typedeclarationsareadded tothe
kjar at compiletime
package org.mypackage
declare Person
name : String
age : int
end
rule "Find adults" when
Person( age > 18,
$name : name )
then
System.out.println( $name );
end
package org.mypackage
declare Person
name : String
age : int
end
rule "Find adults" when
Person( age > 18,
$name : name )
then
System.out.println( $name );
end
import org.mypackage.Person;
// create new instance of a plain Java class
Person bob = new Person();
// set attributes values
bob.setName( “Bob” );
bob.setAge( 2 );
// insert fact into a session
KieSession ksession = ...
ksession.insert( bob );
ksession.fireAllRules();
import org.mypackage.Person;
// create new instance of a plain Java class
Person bob = new Person();
// set attributes values
bob.setName( “Bob” );
bob.setAge( 2 );
// insert fact into a session
KieSession ksession = ...
ksession.insert( bob );
ksession.fireAllRules();
<dependency>
<groupId>org.mycompany</groupId>
<artifactId>myproject</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.mycompany</groupId>
<artifactId>myproject</artifactId>
<version>1.0.0</version>
</dependency>
Type declarations is compiled
and added to the kjar so you
can use it as a plain Java class
30. Solvingloop problems
rule “Salary award for min 2 years service”
when
e : Employee( lengthOfService > 2 )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
end
31. Solvingloop problems
rule “Salary award for min 2 years service” no-loop
when
e : Employee( lengthOfService > 2 )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
end
32. Solvingloop problems
rule “Salary award for min 2 years service” no-loop
when
e : Employee( lengthOfService > 2 )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
end
rule “Salary award for min 8 years service” no-loop
when
e : Employee( lengthOfService > 8 )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
end
33. Solvingloop problems
rule “Salary award for min 2 years service” when
e : Employee( lengthOfService > 2 )
not SalaryMin2Years( employee == e )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
insert ( new SalaryMin2Years(e) );
end
rule “Salary award for min 8 years service” when
e : Employee( lengthOfService > 8 )
not SalaryMin8Years( employee == e )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
insert ( new SalaryMin8Years(e) );
end
34. Solvingloop problems
rule “Year End” when
d : ChangeDate( )
e : Employee( )
then
modify( e ) { lengthOfService(
d.getYear() - e.getStartYear() ) };
end
35.
36. Property Reactive
● Annotate the class:
Java:
DRL:
@PropertyReactive
public class Employee {
int salary;
int lengthOfService;
// … getters/setters
}
@PropertyReactive
public class Employee {
int salary;
int lengthOfService;
// … getters/setters
}
declare Employee
@PropertyReactive
salary : int
lengthOfService : int
}
declare Employee
@PropertyReactive
salary : int
lengthOfService : int
}
37. Property Reactive– problem solved
rule “Salary award for min 2 years service”
when
e : Employee( lengthOfService > 2 )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
end
rule “Salary award for min 8 years service”
when
e : Employee( lengthOfService > 8 )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
end
38. Property Reactive– @Watch
rule “Record Salary Changes”
when
e : Employee( ) @Watch( salary )
then
insert( new SalaryChange( e, e.getSalary() );
end
39. Property Reactive– @Watch
rule “Salary award for min 2 years service”
when
e : Employee( salary < 1000, lengthOfService > 2 ) @Watch( !salary )
then
modify( e ) { setSalary( e.getSalary() * 1.05 ) };
end
42. Forward and Backward Chaining
● Forward Chaining starts with facts/data and trigger actions
or output conclusions
● Backward Chaining starts with goals and search how to
satisfy them (e.g. Prolog)
● Drools is a Hybrid Chaining Systems meaning that it allows
to mix these 2 strategies
● Backward-Chaining is often referred to as derivation queries
and then Drools implements with the query construct
● A query is a simple way to search the working memory for
facts that match the stated conditions
● A query is just a rule with no consequence. It collects all the
results and returns them to the caller
43. A Backward Chaining example
query isContainedIn( String x, String y )
Location( x, y; )
or
( Location( z, y; ) and isContainedIn( x, z; ) )
end
query isContainedIn( String x, String y )
Location( x, y; )
or
( Location( z, y; ) and isContainedIn( x, z; ) )
end
rule “Print all things contained in the Office” when
isContainedIn(thing, "Office"; )
then
System.out.println( "thing " + thing + " is in the Office" );
end
rule “Print all things contained in the Office” when
isContainedIn(thing, "Office"; )
then
System.out.println( "thing " + thing + " is in the Office" );
end
thing Key is in the Office
thing Computer is in the Office
thing Draw is in the Office
thing Desk is in the Office
thing Chair is in the Office
Out Var
(unbuond)
In Var
(buond)
47. Why more than one consequence?
rule "Give 10% discount to customers older than 60"
when
$customer : Customer( age > 60 )
then
modify($customer) { setDiscount( 0.1 ) };
end
rule "Give free parking to customers older than 60"
when
$customer : Customer( age > 60 )
$car : Car ( owner == $customer )
then
modify($car) { setFreeParking( true ) };
end
rule "Give 10% discount to customers older than 60"
when
$customer : Customer( age > 60 )
then
modify($customer) { setDiscount( 0.1 ) };
end
rule "Give free parking to customers older than 60"
when
$customer : Customer( age > 60 )
$car : Car ( owner == $customer )
then
modify($car) { setFreeParking( true ) };
end
Sometimes the constraint of having one single
consequence for each rule can be somewhat limiting and
leads to verbose and difficult to be maintained repetitions
48. Named Consequences
rule "Give 10% discount and free parking to customers older than 60"
when
$customer : Customer( age > 60 )
do[giveDiscount]
$car : Car ( owner == $customer )
then
modify($car) { setFreeParking( true ) };
then[giveDiscount]
modify($customer) { setDiscount( 0.1 ) };
end
rule "Give 10% discount and free parking to customers older than 60"
when
$customer : Customer( age > 60 )
do[giveDiscount]
$car : Car ( owner == $customer )
then
modify($car) { setFreeParking( true ) };
then[giveDiscount]
modify($customer) { setDiscount( 0.1 ) };
end
When the pattern matching
evaluation reaches this point
activate the named consequence
and continue evaluation
Give 10% discount to a customer
older than 60 regardless
if he owns a car or not
49. Conditional Named Consequences
rule "Give free parking and 10% discount to over 60
Golden customer and 5% to Silver ones"
when
$customer : Customer( age > 60 )
if ( type == "Golden" ) do[giveDiscount10]
else if ( type == "Silver" ) break[giveDiscount5]
$car : Car ( owner == $customer )
then
modify($car) { setFreeParking( true ) };
then[giveDiscount10]
modify($customer) { setDiscount( 0.1 ) };
then[giveDiscount5]
modify($customer) { setDiscount( 0.05 ) };
endd
rule "Give free parking and 10% discount to over 60
Golden customer and 5% to Silver ones"
when
$customer : Customer( age > 60 )
if ( type == "Golden" ) do[giveDiscount10]
else if ( type == "Silver" ) break[giveDiscount5]
$car : Car ( owner == $customer )
then
modify($car) { setFreeParking( true ) };
then[giveDiscount10]
modify($customer) { setDiscount( 0.1 ) };
then[giveDiscount5]
modify($customer) { setDiscount( 0.05 ) };
endd
If the condition evaluates to
true activate the named
consequence and continue
Else If this other condition is
met activate the named
consequence and but block
any further evaluation