@@ -78,15 +78,78 @@ export const computeExtendedPublisherId = (publisherId: number, connectionId: st
7878}
7979
8080export interface Publisher {
81+ /**
82+ * Sends a message in the stream
83+ *
84+ * @param {Buffer } message - The encoded content of the message
85+ * @param {MessageOptions } opts - The optional message options and properties
86+ * @returns {SendResult } Returns a boolean value and the associated publishingId
87+ */
8188 send ( message : Buffer , opts ?: MessageOptions ) : Promise < SendResult >
89+
90+ /**
91+ * Sends a message in the stream with a specific publishingId
92+ *
93+ * @param {bigint } publishingId - The associated publishingId
94+ * @param {Buffer } content - The encoded content of the message
95+ * @param {MessageOptions } opts - The optional message options and properties
96+ * @returns {SendResult } Returns a boolean value and the associated publishingId
97+ */
8298 basicSend ( publishingId : bigint , content : Buffer , opts ?: MessageOptions ) : Promise < SendResult >
99+
100+ /**
101+ * Sends all the accumulated messages on the internal buffer
102+ *
103+ * @returns {boolean } Returns false if there was an error
104+ */
83105 flush ( ) : Promise < boolean >
106+
107+ /**
108+ * Sends a batch of messages
109+ *
110+ * @param {Message[] } messages - A batch of messages to send
111+ * @param {CompressionType } compressionType - Can optionally compress the messages
112+ */
84113 sendSubEntries ( messages : Message [ ] , compressionType ?: CompressionType ) : Promise < void >
114+
115+ /**
116+ * Setup the listener for the metadata update event
117+ *
118+ * @param {"metadata_update" } event - The name of the event
119+ * @param {MetadataUpdateListener } listener - The listener which will be called when the event is fired
120+ */
85121 on ( event : "metadata_update" , listener : MetadataUpdateListener ) : void
122+
123+ /**
124+ * Setup the listener for the publish confirm event
125+ *
126+ * @param {"publish_confirm" } event - The name of the event
127+ * @param {PublishConfirmCallback } listener - The listener which will be called when the event is fired
128+ */
86129 on ( event : "publish_confirm" , listener : PublishConfirmCallback ) : void
130+
131+ /**
132+ * Gets the last publishing id in the stream
133+ *
134+ * @returns {bigint } Last publishing id
135+ */
87136 getLastPublishingId ( ) : Promise < bigint >
137+
138+ /**
139+ * Gets the infos of the publisher's connection
140+ *
141+ * @returns {ConnectionInfo } Infos on the publisher's connection
142+ */
88143 getConnectionInfo ( ) : ConnectionInfo
144+
145+ /**
146+ * Close the publisher
147+ *
148+ * @param {boolean } manuallyClose - Weather you want to close the publisher manually or not
149+ */
150+ // TODO - clarify the parameter
89151 close ( manuallyClose : boolean ) : Promise < void >
152+
90153 closed : boolean
91154 ref : string
92155 readonly publisherId : number
0 commit comments