import { Deferred } from "@fluidframework/common-utils" ; import { ITicketedMessage } from "./messages" ; export interface IQueuedMessage { topic : string ; partition : number ; offset : number ; value : string | any ; } export interface IPartition { topic : string ; partition : number ; offset : number ; } export interface IPartitionWithEpoch extends IPartition { leaderEpoch : number ; } export interface IConsumer { readonly groupId : string ; readonly topic : string ; /**
     * Returns true if the consumer is connected
     */ isConnected ( ) : boolean ; /**
     * Closes the consumer.
     */ close ( ) : Promise < void > ; /**
     * Pauses retrieval of new messages
     */ pause ( ) : Promise < void > ; /**
     * Resumes retrival of messages
     */ resume ( ) : Promise < void > ; /**
     * Commits consumer checkpoint offset.
     */ commitCheckpoint ( partitionId , queuedMessage ) : Promise < void > ; /**
     * Returns the offset of the latest consumsed message
     * May return undefined if a consumer is not tracking this
     */ getLatestMessageOffset ( partitionId ) : number | undefined ; /**
     * Event handlers
     */ on ( event , listener ) : this ; on ( event , listener ) : this ; on ( event , listener ) : this ; on ( event , listener ) : this ; on ( event , listener ) : this ; once ( event , listener ) : this ; } /**
 * A pending message the producer is holding on to
 */ export interface IPendingMessage { deferred : Deferred < any > ; message : string ; } export interface IProducer < T = ITicketedMessage > { /**
     * Returns true if the producer is connected
     */ isConnected ( ) : boolean ; param partitionId send ( messages , tenantId , documentId , partitionId ? ) : Promise < void > ; /**
     * Closes the underlying connection
     */ close ( ) : Promise < void > ; /**
     * Event handlers
     */ on ( event , listener ) : this ; once ( event , listener ) : this ; } export interface IPendingBoxcar { documentId : string ; tenantId : string ; deferred : Deferred < void > ; messages : any [ ] ; partitionId ? : number ; }