Class ProcessDefinitionConsumer

java.lang.Object
io.taktx.client.ProcessDefinitionConsumer

public class ProcessDefinitionConsumer extends Object
A consumer that subscribes to process definition activation records from a Kafka topic, maintains a map of deployed process definitions, and notifies registered consumers of updates.
  • Method Details

    • subscribeToDefinitionRecords

      public void subscribeToDefinitionRecords()
      Subscribes to the process definition activation topic and starts processing records. This method creates a Kafka consumer, subscribes to the appropriate topic, and processes incoming records asynchronously. It updates the internal map of deployed process definitions and notifies registered consumers of any updates.
    • stop

      public void stop()
      Stops the consumer from processing further records. This method sets the running flag to false, which will cause the processing loop to exit and the consumer to unsubscribe and close.
    • getDeployedProcessDefinitions

      public Map<io.taktx.dto.ProcessDefinitionKey,io.taktx.dto.ProcessDefinitionDTO> getDeployedProcessDefinitions()
      Retrieves the map of deployed process definitions.
      Returns:
      a map of ProcessDefinitionKey to ProcessDefinitionDTO representing the deployed process definitions
    • getDeployedProcessDefinitions

      public Map<io.taktx.dto.ProcessDefinitionKey,io.taktx.dto.ProcessDefinitionDTO> getDeployedProcessDefinitions(String processDefinitionId)
      Retrieves the deployed process definitions for a specific process definition ID.
      Parameters:
      processDefinitionId - the process definition ID to filter by
      Returns:
      a map of ProcessDefinitionKey to ProcessDefinitionDTO for the specified process definition ID
    • getDeployedProcessDefinitionbyHash

      public Optional<io.taktx.dto.ProcessDefinitionDTO> getDeployedProcessDefinitionbyHash(String processDefinitionId, String hash)
      Retrieves a deployed process definition by its process definition ID and hash.
      Parameters:
      processDefinitionId - the process definition ID to filter by
      hash - the hash to filter by
      Returns:
      an Optional containing the ProcessDefinitionDTO if found, or empty if not found
    • registerProcessDefinitionUpdateConsumer

      public void registerProcessDefinitionUpdateConsumer(BiConsumer<io.taktx.dto.ProcessDefinitionKey,io.taktx.dto.ProcessDefinitionDTO> consumer)
      Registers a consumer to be notified of process definition updates.
      Parameters:
      consumer - a BiConsumer that accepts a ProcessDefinitionKey and ProcessDefinitionDTO to be notified of updates