apache / apache/pulsar-client-node

Support for Avro schema on `createProducer`

Đang mở
#61 1 bình luận 9 reaction 0 người được giao Xem trên GitHub
triage/week-3 type/feature
Ngôn ngữ chính
C++
Star
164
Fork
98
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Would it be possible to add a `schema` property on the config object that initializes `createProducer`? Similar to what Python does, we could initialize [avro-js](https://www.npmjs.com/package/avro-js) with the JSON schema and call `type.getSchema()` to initialize the producer.

Having to disable schema validation on topics isn't ideal for some cases and I think only Java and Python are the clients that have schema support.

A pseudo code would look like:

```js
const client = new Pulsar.Client({
serviceUrl: 'pulsar://localhost:6650',
});

const type = avro.parse({
name: 'Pet',
type: 'record',
fields: [
{name: 'kind', type: {name: 'Kind', type: 'enum', symbols: ['CAT', 'DOG']}},
{name: 'name', type: 'string'}
]
});

const producer = await client.createProducer({
topic: 'persistent://public/default/my-topic',
schema: type.getSchema(),
});
```

I'm not sure if the schema validation happens on the client when creating the producer, even if that is the case `avro-js` has methods to check whether JS objects are valid for a given schema.

On that same line, alternatively, is there any guidelines on how to implement a client? What makes it more difficult for me is that I don't know c++ and I would like to contribute with the JS library (specially Typescript).

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu tại điểm vào createProducer của client Node và xem xét cách cấu hình của nó được truyền vào quá trình tạo producer. Issue đề xuất avro-js và type.getSchema(); xác định một thuộc tính schema nên khởi tạo producer như thế nào và việc xác thực schema nên hoạt động ra sao, sau đó đối chiếu đường đi của Avro producer với hành vi hiện có của client.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, node.js, typescript
Lĩnh vực
backend, distributed-systems
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.