All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.misk.events.SpooledProducer.kt Maven / Gradle / Ivy

package misk.events

import misk.hibernate.Gid
import misk.hibernate.Session

/**
 * A [SpooledProducer] is a producer that writes events to a local spool stored within a
 * service's database. [SpooledProducer]s can be used to coordinate event publishing with
 * local database transactions. Events published to the pool are done within the application's
 * local database transaction; a rollback of the database transaction will also rollback
 * any events published to the spool. Events are asynchronously forwarded from the spool
 * to the event stream, and are done so through a [Producer] transaction.
 */
@Deprecated("This API is no longer supported and replaced by the new event system's client library")
interface SpooledProducer {
  /**
   * Publishes events to a sharded spool.
   *
   * @param session Session for the database transaction the event should be spooled in.
   * @param groupRootId Entity group root ID for the event, used as the sharding key in the database,
   *   and will be passed to the mapping function configured for the spool to look up a partition
   *   key for the event.
   */
  fun publish(session: Session, groupRootId: Gid<*, *>, topic: Topic, vararg event: Event)

  /**
   * Publishes events to an unsharded spool.
   *
   * @param session Session for the database transaction the event should be spooled in.
   */
  fun publishUnsharded(session: Session, topic: Topic, vararg event: Event)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy