@rsdk/kafka.common 6.0.0-next.0 → 6.0.0-next.2

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.
@@ -1,7 +1,10 @@
1
+ import { Timespan } from '@rsdk/common';
1
2
  import { Config } from '@rsdk/core';
2
3
  export declare const VALID_TOPIC_NAME: RegExp;
3
4
  export declare class KafkaConfig extends Config {
4
5
  readonly brokers: string[];
5
6
  readonly consumerGroupSuffix?: string;
6
7
  readonly fromBeginning: boolean;
8
+ readonly sessionTimeout: Timespan;
9
+ readonly heartbeatInterval: Timespan;
7
10
  }
@@ -17,6 +17,8 @@ let KafkaConfig = class KafkaConfig extends core_1.Config {
17
17
  brokers;
18
18
  consumerGroupSuffix;
19
19
  fromBeginning;
20
+ sessionTimeout;
21
+ heartbeatInterval;
20
22
  };
21
23
  exports.KafkaConfig = KafkaConfig;
22
24
  __decorate([
@@ -43,6 +45,29 @@ __decorate([
43
45
  }),
44
46
  __metadata("design:type", Boolean)
45
47
  ], KafkaConfig.prototype, "fromBeginning", void 0);
48
+ __decorate([
49
+ (0, core_1.Property)('KAFKA_CONSUMER_SESSION_TIMEOUT', new core_1.TimespanParser(), {
50
+ description: (0, common_1.text) `
51
+ Timeout in milliseconds used to detect failures. The consumer sends periodic
52
+ heartbeats to indicate its liveness to the broker. If no heartbeats are received
53
+ by the broker before the expiration of this session timeout, then the broker
54
+ will remove this consumer from the group and initiate a rebalance.
55
+ https://kafka.js.org/docs/consuming#a-name-options-a-options`,
56
+ defaultValue: new common_1.Timespan(30, 's'),
57
+ }),
58
+ __metadata("design:type", common_1.Timespan)
59
+ ], KafkaConfig.prototype, "sessionTimeout", void 0);
60
+ __decorate([
61
+ (0, core_1.Property)('KAFKA_CONSUMER_HEARTBEAT_INTERVAL', new core_1.TimespanParser(), {
62
+ description: (0, common_1.text) `
63
+ The expected time in milliseconds between heartbeats to the consumer coordinator.
64
+ Heartbeats are used to ensure that the consumer's session stays active.
65
+ The value must be set lower than session timeout
66
+ https://kafka.js.org/docs/consuming#a-name-options-a-options`,
67
+ defaultValue: new common_1.Timespan(3, 's'),
68
+ }),
69
+ __metadata("design:type", common_1.Timespan)
70
+ ], KafkaConfig.prototype, "heartbeatInterval", void 0);
46
71
  exports.KafkaConfig = KafkaConfig = __decorate([
47
72
  (0, core_1.ConfigSection)()
48
73
  ], KafkaConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"kafka.config.js","sourceRoot":"","sources":["../../src/client/kafka.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AACpC,qCAOoB;AAEP,QAAA,gBAAgB,GAAG,oBAAoB,CAAC;AAG9C,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,aAAM;IAI5B,OAAO,CAAY;IAQnB,mBAAmB,CAAU;IAQ7B,aAAa,CAAW;CAClC,CAAA;AArBY,kCAAW;AAIb;IAHR,IAAA,eAAQ,EAAC,eAAe,EAAE,IAAI,kBAAW,CAAC,IAAI,mBAAY,EAAE,CAAC,EAAE;QAC9D,WAAW,EAAE,uBAAuB;KACrC,CAAC;;4CAC0B;AAQnB;IANR,IAAA,eAAQ,EAAC,6BAA6B,EAAE,IAAI,mBAAY,CAAC,wBAAgB,CAAC,EAAE;QAC3E,WAAW,EAAE,IAAA,aAAI,EAAA;;2CAEsB;QACvC,YAAY,EAAE,SAAS;KACxB,CAAC;;wDACoC;AAQ7B;IANR,IAAA,eAAQ,EAAC,+BAA+B,EAAE,IAAI,iBAAU,EAAE,EAAE;QAC3D,WAAW,EAAE,IAAA,aAAI,EAAA;;4CAEuB;QACxC,YAAY,EAAE,KAAK;KACpB,CAAC;;kDAC+B;sBApBtB,WAAW;IADvB,IAAA,oBAAa,GAAE;GACH,WAAW,CAqBvB"}
1
+ {"version":3,"file":"kafka.config.js","sourceRoot":"","sources":["../../src/client/kafka.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA8C;AAC9C,qCAQoB;AAEP,QAAA,gB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
2
2
  "name": "@rsdk/kafka.common",
3
- "version": "6.0.0-next.0",
3
+ "version": "6.0.0-next.2",
4
4
  "description": "Common functionality for kafka consumers and producers",
5
5
  "license": "Apache License 2.0",
6
6
  "publishConfig": {
@@ -27,5 +27,5 @@
27
27
  "lodash": "^4.17.21",
28
28
  "protobufjs": "^7.2.3"
29
29
  },
30
- "gitHead": "215cccea23d95118dd8b6af3ce11c6a35ce19c30"
30
+ "gitHead": "d051ee5232602e26554ea95e39df20c8f77a5ac3"
31
31
  }
@@ -1,4 +1,4 @@
1
- import { text } from '@rsdk/common';
1
+ import { text, Timespan } from '@rsdk/common';
2
2
  import {
3
3
  ArrayParser,
4
4
  BoolParser,
@@ -6,6 +6,7 @@ import {
6
6
  ConfigSection,
7
7
  Property,
8
8
  StringParser,
9
+ TimespanParser,
9
10
  } from '@rsdk/core';
10
11
 
11
12
  export const VALID_TOPIC_NAME = /^[a-z]+(_[a-z]+)*$/;
@@ -32,4 +33,25 @@ export class KafkaConfig extends Config {
32
33
  defaultValue: false,
33
34
  })
34
35
  readonly fromBeginning!: boolean;
36
+
37
+ @Property('KAFKA_CONSUMER_SESSION_TIMEOUT', new TimespanParser(), {
38
+ description: text`
39
+ Timeout in milliseconds used to detect failures. The consumer sends periodic
40
+ heartbeats to indicate its liveness to the broker. If no heartbeats are received
41
+ by the broker before the expiration of this session timeout, then the broker
42
+ will remove this consumer from the group and initiate a rebalance.
43
+ https://kafka.js.org/docs/consuming#a-name-options-a-options`,
44
+ defaultValue: new Timespan(30, 's'),
45
+ })
46
+ readonly sessionTimeout!: Timespan;
47
+
48
+ @Property('KAFKA_CONSUMER_HEARTBEAT_INTERVAL', new TimespanParser(), {
49
+ description: text`
50
+ The expected time in milliseconds between heartbeats to the consumer coordinator.
51
+ Heartbeats are used to ensure that the consumer's session stays active.
52
+ The value must be set lower than session timeout
53
+ https://kafka.js.org/docs/consuming#a-name-options-a-options`,
54
+ defaultValue: new Timespan(3, 's'),
55
+ })
56
+ readonly heartbeatInterval!: Timespan;
35
57
  }