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

    XMLWordPrintable

Details

    Description

      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

      Prerrequisites

      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>
                      <replicated-cache name="jobs">
                          <transaction mode="BATCH"/>
                      </replicated-cache>
                  </cache-container>
      

      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"/>
                  </channels>
                  <stacks>
                      <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>
                      <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"/>
                      </stack>
                  </stacks>
              </subsystem>
      

      interfaces need to be configured as well

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

      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:230.0.0.4}" 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:230.0.0.4}" 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.

      testing

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: