@rsdk/kafka.common 4.11.0-next.1 → 4.11.1
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.
package/CHANGELOG.md
CHANGED
|
@@ -3,10 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [4.11.
|
|
6
|
+
## [4.11.1](https://github.com/R-Vision/rsdk/compare/v4.11.0...v4.11.1) (2024-07-04)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @rsdk/kafka.common
|
|
9
9
|
|
|
10
|
+
## [4.11.0](https://github.com/R-Vision/rsdk/compare/v4.11.0-next.0...v4.11.0) (2024-07-04)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add KAFKA_CONSUMER_GROUP env ([#248](https://github.com/R-Vision/rsdk/issues/248)) ([966922e](https://github.com/R-Vision/rsdk/commit/966922eda900a71df3bc260a1eb7cf6a3dc7e5c1))
|
|
15
|
+
|
|
16
|
+
## [4.11.0-next.1](https://github.com/R-Vision/rsdk/compare/v4.11.0-next.0...v4.11.0-next.1) (2024-07-04)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add KAFKA_CONSUMER_GROUP env ([#248](https://github.com/R-Vision/rsdk/issues/248)) ([966922e](https://github.com/R-Vision/rsdk/commit/966922eda900a71df3bc260a1eb7cf6a3dc7e5c1))
|
|
21
|
+
|
|
10
22
|
## [4.11.0-next.0](https://github.com/R-Vision/rsdk/compare/v4.10.2...v4.11.0-next.0) (2024-07-04)
|
|
11
23
|
|
|
12
24
|
**Note:** Version bump only for package @rsdk/kafka.common
|
|
@@ -9,10 +9,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.KafkaConfig = void 0;
|
|
12
|
+
exports.KafkaConfig = exports.VALID_TOPIC_NAME = void 0;
|
|
13
|
+
const common_1 = require("@rsdk/common");
|
|
13
14
|
const core_1 = require("@rsdk/core");
|
|
15
|
+
exports.VALID_TOPIC_NAME = /^[a-z]+(_[a-z]+)*$/;
|
|
14
16
|
let KafkaConfig = class KafkaConfig extends core_1.Config {
|
|
15
17
|
brokers;
|
|
18
|
+
consumerGroupSuffix;
|
|
19
|
+
fromBeginning;
|
|
16
20
|
};
|
|
17
21
|
exports.KafkaConfig = KafkaConfig;
|
|
18
22
|
__decorate([
|
|
@@ -21,6 +25,24 @@ __decorate([
|
|
|
21
25
|
}),
|
|
22
26
|
__metadata("design:type", Array)
|
|
23
27
|
], KafkaConfig.prototype, "brokers", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, core_1.Property)('KAFKA_CONSUMER_GROUP_SUFFIX', new core_1.StringParser(exports.VALID_TOPIC_NAME), {
|
|
30
|
+
description: (0, common_1.text) `
|
|
31
|
+
Kafka consumer group suffix in snake case. Suffix will
|
|
32
|
+
be appended to the consumer group id`,
|
|
33
|
+
defaultValue: undefined,
|
|
34
|
+
}),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], KafkaConfig.prototype, "consumerGroupSuffix", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, core_1.Property)('KAFKA_CONSUMER_FROM_BEGINNING', new core_1.BoolParser(), {
|
|
39
|
+
description: (0, common_1.text) `
|
|
40
|
+
When consumer group for this consumer is created, offset will be set to 0
|
|
41
|
+
(not every time consumer reconnects!)`,
|
|
42
|
+
defaultValue: false,
|
|
43
|
+
}),
|
|
44
|
+
__metadata("design:type", Boolean)
|
|
45
|
+
], KafkaConfig.prototype, "fromBeginning", void 0);
|
|
24
46
|
exports.KafkaConfig = KafkaConfig = __decorate([
|
|
25
47
|
(0, core_1.ConfigSection)()
|
|
26
48
|
], KafkaConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kafka.config.js","sourceRoot":"","sources":["../../src/client/kafka.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/kafka.common",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.1",
|
|
4
4
|
"description": "Common functionality for kafka consumers and producers",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"protobufjs": "^7.2.3"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "50e48dd58a91c63d0afb04a5db908f8911ac5945"
|
|
30
30
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VALID_TOPIC_NAME } from './kafka.config';
|
|
2
|
+
|
|
3
|
+
describe('StringMatcher', () => {
|
|
4
|
+
it('should accept correct topic names', () => {
|
|
5
|
+
expect(VALID_TOPIC_NAME.test('abcd_absd')).toBe(true);
|
|
6
|
+
expect(VALID_TOPIC_NAME.test('lower_case_case_case')).toBe(true);
|
|
7
|
+
expect(VALID_TOPIC_NAME.test('lower')).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should reject invalid topic names', () => {
|
|
11
|
+
expect(VALID_TOPIC_NAME.test('abcd1234')).toBe(false);
|
|
12
|
+
expect(VALID_TOPIC_NAME.test('abcd_Av')).toBe(false);
|
|
13
|
+
expect(VALID_TOPIC_NAME.test('abcd_')).toBe(false);
|
|
14
|
+
expect(VALID_TOPIC_NAME.test('_abcd')).toBe(false);
|
|
15
|
+
expect(VALID_TOPIC_NAME.test('Av')).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -1,15 +1,35 @@
|
|
|
1
|
+
import { text } from '@rsdk/common';
|
|
1
2
|
import {
|
|
2
3
|
ArrayParser,
|
|
4
|
+
BoolParser,
|
|
3
5
|
Config,
|
|
4
6
|
ConfigSection,
|
|
5
7
|
Property,
|
|
6
8
|
StringParser,
|
|
7
9
|
} from '@rsdk/core';
|
|
8
10
|
|
|
11
|
+
export const VALID_TOPIC_NAME = /^[a-z]+(_[a-z]+)*$/;
|
|
12
|
+
|
|
9
13
|
@ConfigSection()
|
|
10
14
|
export class KafkaConfig extends Config {
|
|
11
15
|
@Property('KAFKA_BROKERS', new ArrayParser(new StringParser()), {
|
|
12
16
|
description: 'List of Kafka brokers',
|
|
13
17
|
})
|
|
14
18
|
readonly brokers!: string[];
|
|
19
|
+
|
|
20
|
+
@Property('KAFKA_CONSUMER_GROUP_SUFFIX', new StringParser(VALID_TOPIC_NAME), {
|
|
21
|
+
description: text`
|
|
22
|
+
Kafka consumer group suffix in snake case. Suffix will
|
|
23
|
+
be appended to the consumer group id`,
|
|
24
|
+
defaultValue: undefined,
|
|
25
|
+
})
|
|
26
|
+
readonly consumerGroupSuffix?: string;
|
|
27
|
+
|
|
28
|
+
@Property('KAFKA_CONSUMER_FROM_BEGINNING', new BoolParser(), {
|
|
29
|
+
description: text`
|
|
30
|
+
When consumer group for this consumer is created, offset will be set to 0
|
|
31
|
+
(not every time consumer reconnects!)`,
|
|
32
|
+
defaultValue: false,
|
|
33
|
+
})
|
|
34
|
+
readonly fromBeginning!: boolean;
|
|
15
35
|
}
|