You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Put expects records to be written to Kinesis as []byte. This works fine for simple cases but often a more complex layer wraps kinesis-producer and needs more control/flexibility over how different cases (such as failures) are handled. For example, a program might want to handle failures in a special way but right now the FailureResult struct only contains the partition key and the raw data as bytes. There is no other identifying information that might help identify the records.
Accepting an interface instead of raw bytes would make the library a lot more flexible. For example,
Or a record could marshal itself as bytes that kinesis-producer could use internally by calling the Read() method and then wouldn't have to unmarshal the bytes on every failure in order to be able to inspect the record (for specialized logging, retries, failure handling etc).
kinesis-producer API would add an interface definition
In this case, failure channel would just return failed Records and client side implementation could look like:
typeRecordstruct {
IDstringUserIDstringTimestamp time.Time// any other number of fields
}
func (rRecord) Read() []byte {
// marshal r and return []bytes
}
func (rRecord) PartitionKey() string {
returnr.ID
}
The library could also ship with a simple implementation to cover simple cases. Usage would look like:
pr.Put(producer.Record{myData, myPartitionKey})
The text was updated successfully, but these errors were encountered:
Put expects records to be written to Kinesis as []byte. This works fine for simple cases but often a more complex layer wraps kinesis-producer and needs more control/flexibility over how different cases (such as failures) are handled. For example, a program might want to handle failures in a special way but right now the FailureResult struct only contains the partition key and the raw data as bytes. There is no other identifying information that might help identify the records.
Accepting an interface instead of raw bytes would make the library a lot more flexible. For example,
Or a record could marshal itself as bytes that kinesis-producer could use internally by calling the Read() method and then wouldn't have to unmarshal the bytes on every failure in order to be able to inspect the record (for specialized logging, retries, failure handling etc).
kinesis-producer API would add an interface definition
Or partition key could be rolled into the record as well like:
In this case, failure channel would just return failed Records and client side implementation could look like:
The library could also ship with a simple implementation to cover simple cases. Usage would look like:
The text was updated successfully, but these errors were encountered: