Skip to content
Snippets Groups Projects

ci: issuer doesn't see any new connections in GET /connections or GET /connections/:id

Files
2
@@ -7,6 +7,7 @@ import {
JetStreamManager,
JSONCodec,
NatsConnection,
NatsError,
RetentionPolicy,
StorageType,
StreamConfig,
@@ -66,7 +67,7 @@ export class NatsBaseService {
this.jsClient = this.client.jetstream();
this.jsm = await this.client.jetstreamManager();
await this.jsm.streams.add(this.streamConfig);
await this.registerStream(this.streamConfig);
},
{
retries: 5,
@@ -89,4 +90,18 @@ export class NatsBaseService {
disconnect = () => {
return this.client.close();
};
private registerStream = async (sconfig: StreamConfig) => {
try {
return await this.jsm.streams.add(sconfig);
} catch (e) {
this.logger.log(JSON.stringify(e, null, 2));
if (e instanceof NatsError && e.api_error?.err_code === 10065) {
return await this.jsm.streams.get(sconfig.name);
}
throw new Error(`RegisterStream failed.`);
}
};
}
Loading