apache / apache/pulsar-client-node

Support for Avro schema on `createProducer`

オープン
#61 コメント 1 件 リアクション 9 件 担当者 0 名 GitHub で見る
triage/week-3 type/feature
主要言語
C++
スター
164
フォーク
98
PR マージ指標
30日以内にマージされた PR はありません

説明

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).

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Node クライアントの createProducer エントリーポイントから始め、設定が producer の作成にどのように渡されるかを確認します。issue では avro-js と type.getSchema() が提案されています。schema プロパティが producer をどのように初期化すべきか、また schema の検証がどのように動作すべきかを判断し、そのうえで既存のクライアントの動作に照らして Avro producer の経路を検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js, typescript
領域
backend, distributed-systems
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。