-
Notifications
You must be signed in to change notification settings - Fork 25
Add the possibility to match producer and consumed messages using headers instead of just using the message Key. #100
Comments
We would also need this feature, as the keys are not the same in our event flow. |
Since #101 you can provide your own matching function (to match input and output message). Take a look on gatling-kafka-plugin/src/test/scala/ru/tinkoff/gatling/kafka/examples/MatchSimulation.scala Lines 32 to 53 in 519e158
you just need to implement |
@3alster Thanks for the suggestion. How does the matchByOwnVal function work? As I understand the implementation, the function is called every time after sending and receiving a message. But how can I check if the received message matches the sent message? The matchByOwnVal function only returns an array[byte]. What I need is if the received message matches a sent message it should return true, otherwise false and the test should fail. |
@DevArosan that function should return the key from the message. You should implement it in a way that it returns the same key for your input and output message. |
@3alster Thanks for the quick answer. I do not exactly understand. So my use case is, to match some property from my input message to some property of my output message. Because the Key of the message is different and cannot be used to match. How should that work? Could you give me some examples of what that should look like? |
@DevArosan then, just return the matching property of your message by matchByOwnVal. The plugin will do the rest. |
With the current solution, it is only possible to match producer and consumed messages using the key from the sent message. However, in our project, we have an internal key change from produced and consumed messages. This means that with the current implementation we are not able to bind produced messages to consumed one. Therefore Gatling is always returning that the whole flow hasn't been successfully finished.
To solve this issue It can be possible to match consumed and produced messages using some customizable headers, such as correlation-id.
The test scenario would look like snipped below after adding the configurable Headers option:
In order to make this configurable headers option, we already create a Proof of concept.
You can have a look at the last 3 commits of this Repo: https://github.com/imaculan/gatling-kafka-plugin/commits/header_extractor.
Thanks
The text was updated successfully, but these errors were encountered: