narcisoguillen / kafka-node-avro

ISC License
26 stars 13 forks source link

Build config global mechanism #18

Closed narcisoguillen closed 4 years ago

narcisoguillen commented 4 years ago

This branch implements a new feature making possible to customize default mechanisms, we will start to customize all Schema Registry endpoints by

KafkaAvro.config({
  schema_endpoints : {
    alive       : function(id, name, version){ return "subjects"; },
    byId        : function(id, name, version){ return `schemas/ids/${id}`; },
    allVersions : function(id, name, version){ return `subjects/${name}-value/versions`; },
    byVersion   : function(id, name, version){ return `subjects/${name}-value/versions/${version}`; }
  }
});

this are default endpoints.

NOTE 1 : getByName will do a allVersions and then fetch latest with byVersion NOTE 2 : functions MUST return a String

Pending work : tests, README