Class ZookeeperStateMachinePersist<S,E>

java.lang.Object
org.springframework.statemachine.zookeeper.ZookeeperStateMachinePersist<S,E>
Type Parameters:
S - the type of state
E - the type of event
All Implemented Interfaces:
StateMachinePersist<S,E,org.apache.zookeeper.data.Stat>

public class ZookeeperStateMachinePersist<S,E> extends Object implements StateMachinePersist<S,E,org.apache.zookeeper.data.Stat>
StateMachinePersist using zookeeper as a storage and kroy libraries as a backing serialization technique.

Persisted bytes are deserialised through Kryo with the safe-by-default class allowlist applied. Applications that use custom state or event types (typically enums) must register those types via the ZookeeperStateMachinePersist(CuratorFramework, String, String, int, Consumer) constructor's kryoCustomizer parameter; otherwise Kryo will reject them with IllegalArgumentException ("Class is not registered").

  • Constructor Details

    • ZookeeperStateMachinePersist

      public ZookeeperStateMachinePersist(org.apache.curator.framework.CuratorFramework curatorClient, String path)
      Instantiates a new zookeeper state machine persist.
      Parameters:
      curatorClient - the curator client
      path - the path for persistent state
    • ZookeeperStateMachinePersist

      public ZookeeperStateMachinePersist(org.apache.curator.framework.CuratorFramework curatorClient, String path, String logPath, int logSize)
      Instantiates a new zookeeper state machine persist.
      Parameters:
      curatorClient - the curator client
      path - the path
      logPath - the log path
      logSize - the log size
    • ZookeeperStateMachinePersist

      public ZookeeperStateMachinePersist(org.apache.curator.framework.CuratorFramework curatorClient, String path, String logPath, int logSize, Consumer<com.esotericsoftware.kryo.Kryo> kryoCustomizer)
      Instantiates a new zookeeper state machine persist with a custom Kryo configurer for application-specific allowlist registrations.
      Parameters:
      curatorClient - the curator client
      path - the path
      logPath - the log path (may be null)
      logSize - the log size (must be a positive power of two when logPath is set)
      kryoCustomizer - optional callback invoked once per Kryo instance after the framework's default registrations are applied. Use this to register application-specific state and event types (typically enums) so that they are accepted by the allowlist. May be null.
      Since:
      4.0.2
  • Method Details