sarama
sarama copied to clipboard
Mock broker set message header
Versions
Sarama | Kafka | Go |
---|---|---|
v1.26.4 | N/A | 1.14.2 |
Problem Description
I want to write some tests about the message header. Is there a way to set header to message?
broker := sarama.NewMockBroker(t, 0)
defer broker.Close()
broker.SetHandlerByMap(map[string]sarama.MockResponse{
"MetadataRequest": sarama.NewMockMetadataResponse(t).
SetBroker(broker.Addr(), broker.BrokerID()).
SetLeader("test-topic", 0, broker.BrokerID()),
"OffsetRequest": sarama.NewMockOffsetResponse(t).
SetOffset("test-topic", 0, sarama.OffsetOldest, 0).
SetOffset("test-topic", 0, sarama.OffsetNewest, 1),
"FetchRequest": sarama.NewMockFetchResponse(t, 1).
SetMessage("test-topic", 0, 0, sarama.StringEncoder("hello")).
})
Currently, I can only set the message.
SetMessage("test-topic", 0, 0, sarama.StringEncoder("hello"))
Relates to https://github.com/Shopify/sarama/issues/1665
First version that supports headers is sarama.V0_11_0_0
and MockBroker doesn't work with it.
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the master branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.
Are there any plans to support the sarama.V0_11_0_0
version by the MockBroker in order to test messages with headers?
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.
Any updates on MockBroker test messages with headers?