apache / apache/pulsar-client-node
Support for Avro schema on `createProducer`
- Langage dominant
- C++
- Étoiles
- 164
- Forks
- 98
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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).
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez au point d’entrée createProducer du client Node et examinez comment sa configuration est transmise à la création du producer. L’issue propose avro-js et type.getSchema() ; déterminez comment une propriété schema devrait initialiser le producer et quel devrait être le comportement de la validation du schema, puis vérifiez le chemin du producer Avro par rapport au comportement existant du client.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, node.js, typescript
- Domaine
- backend, distributed-systems
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100