apache / apache/pulsar-client-node
Support for Avro schema on `createProducer`
- Lingua principale
- C++
- Stelle
- 164
- Fork
- 98
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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).
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia dal punto di ingresso createProducer del client Node e verifica come la sua configurazione viene passata alla creazione del producer. L’issue propone avro-js e type.getSchema(); determina come una proprietà schema dovrebbe inizializzare il producer e come dovrebbe comportarsi la validazione dello schema, quindi verifica il percorso del producer Avro rispetto al comportamento esistente del client.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, node.js, typescript
- Ambito
- backend, distributed-systems
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100