Class ProducerService

java.lang.Object
org.imixs.workflow.kafka.ProducerService
All Implemented Interfaces:
Serializable

public class ProducerService extends Object implements Serializable
The ProducerService is a Kafka client that publishes workflow events to the Kafka cluster.

The kafka producer is thread safe and sharing a single producer instance across threads will generally be faster than having multiple instances. For that reason we use a @Singleton with @ConcurrencyManagement

The producer consists of a pool of buffer space that holds records that haven't yet been transmitted to the server as well as a background I/O thread that is responsible for turning these records into requests and transmitting them to the cluster. Failure to close the producer after use will leak these resources.

Version:
1.0
Author:
rsoika
See Also:
  • Constructor Details

    • ProducerService

      public ProducerService()
  • Method Details

    • onProcess

      public void onProcess(@Observes org.imixs.workflow.engine.ProcessingEvent documentEvent)
      Autowire:

      On each workflow process event a new message is generated if the workflow model version matches the setup.

    • sendWorkitem

      public void sendWorkitem(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.AdapterException
      This method sends a kafka message based on a given workitem.

      The topic ofi the message is the model version

      The value is a serialized version of the workitem.

      Parameters:
      workitem -
      Throws:
      org.imixs.workflow.exceptions.AdapterException