Open flqw opened 4 years ago
Adds support for the different subject name strategies provided from confluent:
TopicNameStrategy
${topic}-${isKey ? 'key' : 'value'}
TopicRecordNameStrategy
${topic}-${recordName}
RecordNameStrategy
recordName
Adds the following functions:
encodeKeyBySchema: (strategy: string, schema: any, msg: any, parseOptions?: any) => Promise<Buffer> encodeMessageBySchema: (strategy: string, schema: any, msg: any, parseOptions?: any) => Promise<Buffer> encodeMessageByTopicRecordName: (topic: string, recordName: string, msg: any, parseOptions?: any) => Promise<Buffer> encodeMessageByRecordName: (recordName: string, msg: any, parseOptions?: any) => Promise<Buffer> getSchemaByTopicRecordName: (topic: string, recordName: string, parseOptions?: any) => Promise<{ id: number, parsedSchema: any }> getSchemaByRecordName: (recordName: string, parseOptions?: any) => Promise<{ id: number, parsedSchema: any }>
Strategy constants can be accessed via the registry object e.g. registry.Strategy.RecordNameStrategy.
registry.Strategy.RecordNameStrategy
All existing functions fall back to TopicNameStrategy to be backwards compatible.
I fixed the existing tests but did not write some for the new functions, i also have not updated the readme.
Adds support for the different subject name strategies provided from confluent:
TopicNameStrategy
(the one currently supported) Subject:${topic}-${isKey ? 'key' : 'value'}
TopicRecordNameStrategy
Subject:${topic}-${recordName}
RecordNameStrategy
Subject:recordName
Adds the following functions:
Strategy constants can be accessed via the registry object e.g.
registry.Strategy.RecordNameStrategy
.All existing functions fall back to
TopicNameStrategy
to be backwards compatible.I fixed the existing tests but did not write some for the new functions, i also have not updated the readme.