@loadstrike/loadstrike-sdk 1.0.15601 → 1.0.16801

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4911,6 +4911,10 @@ class ManagedScenarioTrackingRuntime {
4911
4911
  if (this.sourceOnlyMode) {
4912
4912
  return;
4913
4913
  }
4914
+ await this.destinationAdapter?.initialize?.();
4915
+ if (this.runMode === "correlateexistingtraffic") {
4916
+ await this.sourceAdapter.initialize?.();
4917
+ }
4914
4918
  this.destinationLoop = this.consumeDestinationLoop();
4915
4919
  if (this.runMode === "correlateexistingtraffic") {
4916
4920
  this.sourceLoop = this.consumeSourceLoop();
@@ -1012,6 +1012,9 @@ class CallbackAdapter {
1012
1012
  this.consumeStreamStarted = false;
1013
1013
  this.endpoint = endpoint;
1014
1014
  }
1015
+ async initialize() {
1016
+ return undefined;
1017
+ }
1015
1018
  async produce(payload) {
1016
1019
  if (this.endpoint.mode !== "Produce") {
1017
1020
  return null;
@@ -1228,6 +1231,12 @@ class KafkaEndpointAdapter extends CallbackAdapter {
1228
1231
  this.consumerStartPromise = null;
1229
1232
  this.queue = [];
1230
1233
  }
1234
+ async initialize() {
1235
+ if (resolveConsumeDelegate(this.endpoint) || this.endpoint.mode !== "Consume") {
1236
+ return;
1237
+ }
1238
+ await this.ensureConsumerStarted();
1239
+ }
1231
1240
  async produce(payload) {
1232
1241
  if (resolveProduceDelegate(this.endpoint)) {
1233
1242
  return super.produce(payload);
@@ -1405,6 +1414,12 @@ class NatsEndpointAdapter extends CallbackAdapter {
1405
1414
  this.subscription = null;
1406
1415
  this.queue = [];
1407
1416
  }
1417
+ async initialize() {
1418
+ if (resolveConsumeDelegate(this.endpoint) || this.endpoint.mode !== "Consume") {
1419
+ return;
1420
+ }
1421
+ await this.ensureSubscriptionStarted();
1422
+ }
1408
1423
  async produce(payload) {
1409
1424
  if (resolveProduceDelegate(this.endpoint)) {
1410
1425
  return super.produce(payload);
@@ -1598,6 +1613,12 @@ class AzureEventHubsEndpointAdapter extends CallbackAdapter {
1598
1613
  this.subscription = null;
1599
1614
  this.queue = [];
1600
1615
  }
1616
+ async initialize() {
1617
+ if (resolveConsumeDelegate(this.endpoint) || this.endpoint.mode !== "Consume") {
1618
+ return;
1619
+ }
1620
+ await this.ensureSubscriptionStarted();
1621
+ }
1601
1622
  async produce(payload) {
1602
1623
  if (resolveProduceDelegate(this.endpoint)) {
1603
1624
  return super.produce(payload);
@@ -4891,6 +4891,10 @@ class ManagedScenarioTrackingRuntime {
4891
4891
  if (this.sourceOnlyMode) {
4892
4892
  return;
4893
4893
  }
4894
+ await this.destinationAdapter?.initialize?.();
4895
+ if (this.runMode === "correlateexistingtraffic") {
4896
+ await this.sourceAdapter.initialize?.();
4897
+ }
4894
4898
  this.destinationLoop = this.consumeDestinationLoop();
4895
4899
  if (this.runMode === "correlateexistingtraffic") {
4896
4900
  this.sourceLoop = this.consumeSourceLoop();
@@ -976,6 +976,9 @@ class CallbackAdapter {
976
976
  this.consumeStreamStarted = false;
977
977
  this.endpoint = endpoint;
978
978
  }
979
+ async initialize() {
980
+ return undefined;
981
+ }
979
982
  async produce(payload) {
980
983
  if (this.endpoint.mode !== "Produce") {
981
984
  return null;
@@ -1192,6 +1195,12 @@ class KafkaEndpointAdapter extends CallbackAdapter {
1192
1195
  this.consumerStartPromise = null;
1193
1196
  this.queue = [];
1194
1197
  }
1198
+ async initialize() {
1199
+ if (resolveConsumeDelegate(this.endpoint) || this.endpoint.mode !== "Consume") {
1200
+ return;
1201
+ }
1202
+ await this.ensureConsumerStarted();
1203
+ }
1195
1204
  async produce(payload) {
1196
1205
  if (resolveProduceDelegate(this.endpoint)) {
1197
1206
  return super.produce(payload);
@@ -1369,6 +1378,12 @@ class NatsEndpointAdapter extends CallbackAdapter {
1369
1378
  this.subscription = null;
1370
1379
  this.queue = [];
1371
1380
  }
1381
+ async initialize() {
1382
+ if (resolveConsumeDelegate(this.endpoint) || this.endpoint.mode !== "Consume") {
1383
+ return;
1384
+ }
1385
+ await this.ensureSubscriptionStarted();
1386
+ }
1372
1387
  async produce(payload) {
1373
1388
  if (resolveProduceDelegate(this.endpoint)) {
1374
1389
  return super.produce(payload);
@@ -1562,6 +1577,12 @@ class AzureEventHubsEndpointAdapter extends CallbackAdapter {
1562
1577
  this.subscription = null;
1563
1578
  this.queue = [];
1564
1579
  }
1580
+ async initialize() {
1581
+ if (resolveConsumeDelegate(this.endpoint) || this.endpoint.mode !== "Consume") {
1582
+ return;
1583
+ }
1584
+ await this.ensureSubscriptionStarted();
1585
+ }
1565
1586
  async produce(payload) {
1566
1587
  if (resolveProduceDelegate(this.endpoint)) {
1567
1588
  return super.produce(payload);
@@ -745,6 +745,7 @@ export declare const HttpAuthOptions: typeof HttpAuthOptionsModel;
745
745
  export declare const KafkaSaslOptions: typeof KafkaSaslOptionsModel;
746
746
  export type EndpointDefinitionInput = EndpointDefinition | DotNetEndpointDefinition | HttpEndpointDefinition | KafkaEndpointDefinition | RabbitMqEndpointDefinition | NatsEndpointDefinition | RedisStreamsEndpointDefinition | AzureEventHubsEndpointDefinition | DelegateStreamEndpointDefinition | PushDiffusionEndpointDefinition;
747
747
  export interface EndpointAdapter {
748
+ initialize?(): Promise<void>;
748
749
  produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
749
750
  consume(): Promise<TrackingPayload | null>;
750
751
  dispose?(): Promise<void>;
@@ -754,6 +755,7 @@ declare class CallbackAdapter implements EndpointAdapter {
754
755
  private readonly consumeQueue;
755
756
  private consumeStreamStarted;
756
757
  constructor(endpoint: EndpointDefinition);
758
+ initialize(): Promise<void>;
757
759
  produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
758
760
  consume(): Promise<TrackingPayload | null>;
759
761
  dispose(): Promise<void>;
@@ -782,6 +784,7 @@ declare class AzureEventHubsEndpointAdapter extends CallbackAdapter {
782
784
  private subscriptionPromise;
783
785
  private subscription;
784
786
  private readonly queue;
787
+ initialize(): Promise<void>;
785
788
  produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
786
789
  consume(): Promise<TrackingPayload | null>;
787
790
  dispose(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadstrike/loadstrike-sdk",
3
- "version": "1.0.15601",
3
+ "version": "1.0.16801",
4
4
  "description": "TypeScript and JavaScript SDK for in-process load execution, traffic correlation, and reporting.",
5
5
  "keywords": [
6
6
  "load-testing",