Emergency Services V2: jBPM5 and Drools Blueprint

I’m proud to release the second version of the Emergency Services jBPM5 and Drools demo application. We (@ilesteban and I @salaboy) spend a fair amount of time creating the second version that helps us to show some best practices about how to build applications on top of the Drools & jBPM5 platform. We are advertising this application as a jBPM5 and Drools blueprint that shows one of the possible architectures that can be used to build robust applications mixing Business Processes, Business Rules and Complex Event Processing. I’m also happy to announce that a new dev has join us (@calcacuervo) in this effort to share best practices and an end to end application that shows. We are waiting for your feedback and contributions, feel free to join us there are tons of things to do!

Logo!

This version was already presented in a couple of events like: JUDCon and a some bootcamps in the US, where we receive awesome feedback and that really motivate us to keep going and improving what we got. We were very happy to see that some Red Hat’s solution architects were using the application to show their customers how the jBPM5 and Drools project can be used to build smarter applications.

New Features / Improvements

The focus of this second version was a complete refactoring to the old code base that was messy and cannot be reused, improved or extended. We decouple the monolithic project into separated modules that interacts using asynchronous messages (HornetQ/JMS).
Taking advantage of these decouple architecture we also include Drools Grid that enables the application to run in a distributed cluster of virtual/physical machines. The application now has the availability of create knowledge based services in different remote nodes being able to distribute the load between different machines.
The use case that is currently supported it’s the same as the one implemented in the version 1 of the application. But the current implementation allows us to easily extend and add more use cases that involve collaboration between different entities inside the city. The new set of decoupled components have a well defined scope and responsibility that it’s described in the following section. We also create a new Emergency Dashboard to show in real time what’s happening in a specific emergency and how many emergencies we are handling in a specific moment in time.

Finally we open a wiki that can be found here, to help the new comers that are interested to play with the application to download it and play with it.

Application Structure / Modules

The current version of the application contains the following modules:

  • emergency-service-model
  • emergency-service-core
  • emergency-service-world-ui-slick
  • emergency-service-tasklists-ui-swing
  • emergency-service-tasklist-ui-web
  • emergency-service-sensor

In order to understand how the application works and how all these modules interacts we need to understand the scope and responsibility of each of them. The following sections explains the scope and how the functionality was separated in order to support the use cases.

Emergency Service Model

This simple Java (JAR) project includes all the Domain POJOs definitions. Inside this project we define all the classes that represent the data structures that will be used by the rest of the modules and are related to our domain. In this case because we are modeling and Emergency Services Company like 911 we will have some POJOS like: Emergency, Call, Vehicle, Ambulance, etc. You will find also a couple of utility classes and Drools/JBPM5 artifacts that were included here for simplicity. This JAR package needs to be shared by all the different processes that are created for this application to work. Because the new design was conceived for a distributed environment we need to provide a package (or a set of packages) that contains all the domain specific dependencies that will be needed by the different runtimes that will be dynamically spawned by the application.

Emergency Service Core

The core project now contains a set of services that encapsulate the logic required by the application. The current defined services are all knowledge based services. This means that all of them are using rules, processes and events. But the main idea is to be able to plug any type of service. For future release will make sense to split this module to be able to manage one or a group of services together. You can browse the currently defined services here: https://github.com/Salaboy/emergency-service-drools-app/tree/master/emergency-service-core/src/main/java/com/wordpress/salaboy/services

You will notice that we have a service that it’s in charge of dynamically create new services instances based on the situation that we are trying to solve, allowing us to plug new procedures without the need of modifying how the procedures are started.

This project is also containing the processes and rules assets inside the src/main/resources directory. For future versions of the project the assets should be placed inside the Knowledge Repository (Guvnor) and use a knowledge agent to retrieve these assets when they are needed.

Emergency Service World UI

Right now the application has only one implementation of the World UI component. We are using a library called slick: http://slick.cokeandcode.com/. The main responsibility of this module is to show what it’s happening in the city. In real application we don’t have a representation of what’s happening, but for this demo we want to show and let you interact with the real world to simulate different situations. It’s important for us to show what it’s happening, but you need to remember that from inside the company, where all the employees are working, they will receive only notifications about the external world.

City Map (World UI)

Emergency Service Task Lists UI

The application right now provides two different implementations for the task lists user interfaces. Remember that the Task Lists UIs will represent the software that will be used by the companies employees. The tasks will be created by business processes and also business rules when are required. The users will automatically receive the created tasks in their task lists. Both implementations are using a project called smart-tasks to improve how the task lists and task form are defined and configured. The web version uses some more advanced features of smart tasks to demonstrate how the project can be used to quickly build task list oriented front ends to interact with the human activities created by our business knowledge. You can find more about the smart tasks project here: https://github.com/Salaboy/smart-tasks.

Task Form (Task Lists UI)

Emergency Service Sensor

This module contains the different adaptors to support external sources of events that can be used to represent real life information that it’s coming into our system. The first version of this application was working only with a Nintentdo Wii Remote Control (WiiMote), but the new version supports also the accelerometer of the IPhone. You should only install a free application called AccSim in your phone to send the accelerometer events. We use these accelerometers to simulate the patients heart beats when we have a heart attack situation.
We are thinking to provide an extra module to support Android devices as well, but it’s still under development at the moment.

Roadmap

The roadmap at this point for V3 is to improve the way to execute and extend the application. We will fight to include more complex use cases using the current architecture. We will be targeting the V3 for Rules Fest (October 24-27), and this version will include more dynamic mechanisms to discover the procedures that needs to be executed in order to solve more complex scenarios. For that reason we will be implementing multiple procedures that involves different entities like the police department and the fire department. The real fun begins when we want to solve situations that involves more than one entity to be coordinated. We are looking forward to implement some graphical aids to be able to show alerts inside the map in real time as they happen.

One minor refactor that we will be doing is creating a separate module for the Real Time Dashboard project, because right now it is included inside the Task Lists UI Swing application, but it doesn’t belong there.

Emergency Dashboard

I will be writing a more detailed post about the architecture of the application and logic that it’s being executed by each service inside the application soon. Also a detailed roadmap will be created based on the feedback. Please don’t post commands about THE MONSTER! we will be adding that use case as well :)

THE MONSTER!

If you want to see something in particular implemented here, please write a comment.

Notes

We want to notify to all the people that its downloading the application and want to start playing with it a couple of things:

  1. We are not creating tags/branches to keep the stable versions. We don’t have a tag/branch for Version 1 and Version 2. We strongly believe that there are a lot of things that needs to be improved in order to create what we think is a stable version. If you check out the current code please remember that you are getting the latest code that it’s under continuous refactoring and improvement. Write us if you are having troubles, we will be here to help you.
  2. If you want to play with the application take a look at the wiki for the documentation and how to’s to set up and run the application in different operating systems. If you have troubles, please report them sending me an email: (salaboy AT gmail DOT com – esteban DOT aliverti AT gmail DOT com)  or add a comment to the project. If you solve a problem related with your platform, please send us the information and we will include that in the wiki pages.
  3. We are mentoring and helping people to get involved. If you want to show or demonstrate how these projects like Drools, jBPM, HornetQ and Inifinispan works and how they can be used in your applications please contribute with this project. We build a generic architecture that can be adapted to almost every application domain. Everyone can benefit for the features that we are adding here in this application. For creating your own domain specific application then you can copy and paste the mechanisms and adapt the processes, rules and events sources to work for your domain.
About these ads
Tagged , , , , , , , , , , , , , , , , , , , , ,

14 thoughts on “Emergency Services V2: jBPM5 and Drools Blueprint

  1. [...] that it’s a good opportunity for you to make your hands dirty with code and helps us in the Emergency Services initiave. Please write me back if you are interested in collaborating adding these features into [...]

  2. [...] back again with another post about the Emergency Services Application to show the new features that we just add and how to get started with the project. Some new modules [...]

  3. [...] Dr. V post about the release! Great job Dr. V! Stay tuned! I will be configuring and updating the emergency services application to use this new release with all the new tooling! « Emergency Services V2: [...]

  4. [...] the project or learning about these technologies, you can join me in some of my initiatives like: Emergency Services Application and Community Trainings (Drools5 Community Traning  & jBPM5 Community Training ) as well as [...]

  5. Franklin says:

    There seems to be an error in the run folder pom.xml

    Need to change

    win32

    windows

    win

    to

    win32

    windows

    win32

    Regards,
    Franklin

  6. [...] The new version that we are planning will allow us to build and show more complex scenarios. Exposing all the tools that we need to adapt the application to new use cases and support mixed scenarios where we cannot predefine all the actions that needs to be executed. The main purpose of this post is to show the ideas that we have in the top of our head and encourage the community to contribute adding ideas or things that you want to see in the app. Consider this post as a brainstorm about the things that we will be doing this next month. You can always track our advances and download the code here: https://github.com/Salaboy/emergency-service-drools-app For more information about the application you can take a look here: http://salaboy.wordpress.com/2011/05/28/emergency-services-v2-jbpm5-and-drools-blueprint/ [...]

  7. yusrin says:

    hi salaboy,

    great example for jBPM starters like me, would you me show me on how to use JPAWorkingMemoryDbLogger in emergency service?

    its show Not supported session in logger: class org.drools.grid.remote.StatefulKnowledgeSessionRemoteClient when i used JPAWorkingMemoryDbLogger.

    • salaboy says:

      Hi yusrin,
      As you may know inside the Emergency Service application we are using drools-grid, that allows us distribute the application in different machines if we want and run different knowledge sessions in different machines if it’s necessary.
      As you mention the JPAWorkingMemoryDBLogger does not support the RemoteClient implementation that its used inside grid. We will definitely add that feature in the future but its not there yet. What you can do is add listeners in each session configuration to log what is happening in the session that you want to monitor.
      Best Regards

  8. Cácio says:

    Cara, cheguei a esse blog por uma entrevista que você deu ao InfoQ\br.

    Poxa, seria interessante, já que seu blog tem por objetivo facilitar e servir de porta de entrada aos iniciantes em Drools e jBPM, que tivesse artigos em português.

    • salaboy says:

      I wish I know portuguese. For the moment just in English and Spanish only. I’m trying to write everything in English because most of the technical tutorials and documentation is in English.
      Cheers

  9. [...] inside the niche. This will be my third Rules Fest in a row and I will be presenting the Emergency Service application and talking about jBPM5 there. If you are around San Francisco, USA (OCTOBER 24-27) and [...]

  10. boοkmarked!!, Ι rеаlly like your bloɡ!

  11. Qualitү ρosts is the secret to invite the νіewers
    to ƿay a quicк visit the site, that’s what this site is providing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 973 other followers

%d bloggers like this: