Skip to content

Commit

Permalink
change(jetstream): JetStreamClient#pull() was deprecated and has been…
Browse files Browse the repository at this point in the history
… removed. Use Consumer#next().

Signed-off-by: Alberto Ricart <[email protected]>
  • Loading branch information
aricart committed Oct 16, 2024
1 parent 1cf1725 commit 3db4ef7
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1,132 deletions.
28 changes: 0 additions & 28 deletions jetstream/src/jsclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,34 +298,6 @@ export class JetStreamClientImpl extends BaseApiClientImpl
return pa;
}

async pull(stream: string, durable: string, expires = 0): Promise<JsMsg> {
validateStreamName(stream);
validateDurableName(durable);

let timeout = this.timeout;
if (expires > timeout) {
timeout = expires;
}

expires = expires < 0 ? 0 : nanos(expires);
const pullOpts: Partial<PullOptions> = {
batch: 1,
no_wait: expires === 0,
expires,
};

const msg = await this.nc.request(
`${this.prefix}.CONSUMER.MSG.NEXT.${stream}.${durable}`,
this.jc.encode(pullOpts),
{ noMux: true, timeout },
);
const err = checkJsError(msg);
if (err) {
throw err;
}
return toJsMsg(msg, this.timeout);
}

/*
* Returns available messages upto specified batch count.
* If expires is set the iterator will wait for the specified
Expand Down
9 changes: 0 additions & 9 deletions jetstream/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,6 @@ export interface JetStreamClient {
options?: Partial<JetStreamPublishOptions>,
): Promise<PubAck>;

/**
* Retrieves a single message from JetStream
* @param stream - the name of the stream
* @param consumer - the consumer's durable name (if durable) or name if ephemeral
* @param expires - the number of milliseconds to wait for a message
* @deprecated - use {@link Consumer#fetch()}
*/
pull(stream: string, consumer: string, expires?: number): Promise<JsMsg>;

/**
* Similar to pull, but able to configure the number of messages, etc. via PullOptions.
* @param stream - the name of the stream
Expand Down
Loading

0 comments on commit 3db4ef7

Please sign in to comment.