Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-3189

EJB timers - Duplicate process instances with "Start Timer" event



    • Enhancement
    • Resolution: Done
    • Major
    • 7.10.0.GA
    • 7.8.0.GA
    • Kie-Server
    • RHPAM 7.8

      PostgreSQL 11

    • 2020 Week 40-42 (from Sep 28), 2020 Week 43-45 (from Okt 19), 2020 Week 46-48 (from Nov 9), 2020 Week 49-51 (from Nov 30)


      In a PAM 7.8 high-availability setup on EAP 7.3.2 with 2 kie-server nodes (with PostgreSQL 11 + EJB timers), a "start timer" event in a process model creates duplicate process instances when the specified time is reached. 

      Cluster support for jbpm engine and kie server (only EAP)

      It has two parts.

      1. jbpm CluterAwarenessService
      2. infinispan kie server cluster awareness service implementation

      It is used for Jobs failover. When a node is killed or left automatically all jobs in that instance are requeued to another node.
      In case there is timer start node in a process it only works in one of the nodes

      Cluster are per kie server id

      Steps to use it


      check the subsystems in the standalone.xml are installed

              <extension module="org.jboss.as.clustering.infinispan"/>
              <extension module="org.jboss.as.clustering.jgroups"/>

      under the subsystem

              <subsystem xmlns="urn:jboss:domain:infinispan:9.0">

      you need to create the next container and cache (you can setup in any way you want but the container must be named jbpm and 2 caches need to be created (nodes and jobs)

                  <cache-container name="jbpm">
                      <transport lock-timeout="60000"/>
                      <replicated-cache name="nodes">
                          <transaction mode="BATCH"/>
                      <replicated-cache name="jobs">
                          <transaction mode="BATCH"/>

      example of jgroups subsystem for replicate and distribute cache

            <subsystem xmlns="urn:jboss:domain:jgroups:7.0">
                  <channels default="ee">
                      <channel name="ee" stack="udp" cluster="ejb"/>
                      <stack name="udp">
                          <transport type="UDP" socket-binding="jgroups-udp"/>
                          <protocol type="PING"/>
                          <protocol type="MERGE3"/>
                          <socket-protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
                          <protocol type="FD_ALL"/>
                          <protocol type="VERIFY_SUSPECT"/>
                          <protocol type="pbcast.NAKACK2"/>
                          <protocol type="UNICAST3"/>
                          <protocol type="pbcast.STABLE"/>
                          <protocol type="pbcast.GMS"/>
                          <protocol type="UFC"/>
                          <protocol type="MFC"/>
                          <protocol type="FRAG3"/>
                      <stack name="tcp">
                          <transport type="TCP" socket-binding="jgroups-tcp"/>
                          <socket-protocol type="MPING" socket-binding="jgroups-mping"/>
                          <protocol type="MERGE3"/>
                          <socket-protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
                          <protocol type="FD_ALL"/>
                          <protocol type="VERIFY_SUSPECT"/>
                          <protocol type="pbcast.NAKACK2"/>
                          <protocol type="UNICAST3"/>
                          <protocol type="pbcast.STABLE"/>
                          <protocol type="pbcast.GMS"/>
                          <protocol type="MFC"/>
                          <protocol type="FRAG3"/>

      interfaces need to be configured as well

             <interface name="private">
                  <inet-address value="${jboss.bind.address.private:}"/>

      and sockets in

      <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
              <socket-binding name="jgroups-mping" interface="private" multicast-address="${jboss.default.multicast.address:}" multicast-port="45700"/>
              <socket-binding name="jgroups-tcp" interface="private" port="7600"/>
              <socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>
              <socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:}" multicast-port="45688"/>
              <socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>

      install extension

      Add to the jboss-deployment-structure.xml in kie-server.war/WEB-INF/jboss-deployment-structure.xml the below dependecies:

            <module name="org.infinispan" services="export"/>
            <module name="org.jgroups" />

      once all is check you need to copy the jar kie-server-services-jbpm-cluster.jar in kie-server.war/WEB-INF/lib

      and automatically you will be able to use failover in jobs.


      Job failover

      1. setup 2 or more kie server instances
      2. create a job org.kie.server.services.jbpm.cluster.ReoccurringLongPrintOutCommand
      3. while the job is being executed kill the instance is executing it.

      it should inmediatelly executed in the other node.

      Start process once in clustered nodes.

      1. create a project with a start timer
      2. deploy
      3. only one process in the entire cluster will start.


        Issue Links



              elguardian@gmail.com Enrique González Martínez
              balki404 Balakrishnan Balasubramanian (Inactive)
              Antonio Fernandez Alhambra Antonio Fernandez Alhambra (Inactive)
              Antonio Fernandez Alhambra Antonio Fernandez Alhambra (Inactive)
              0 Vote for this issue
              5 Start watching this issue