Hi,
I started using ru.tinkoff java kafka plugin recommended on Gatling site.
I need to send protobuf kafka message serialized in byte array, but I can not use feeder in send method.
.exec(kafka(“ReqRep”)
.requestReply()
.requestTopic(“inboundTopic”)
.replyTopic(“outboundTopic”)
.send(“#{INCREMENT_NUMBER}”,
EventWrapperBuilder
.createEvent(“#{INCREMENT_NUMBER}”, “#{EVENT_TYPE}”).toByteArray(),
headers,
String.class, byte.class)
)
First param in send method (“#{INCREMENT_NUMBER}”) will work fine, because it’s string, and send() method will recognize it’s value from feeder session, it will take correct number from feeder (1, 2, 3…).
Second param doesn’t work because my custom method will see both values as constants (instead of 1,2,3 it will put constant #{INCREMENT_NUMBER}" and “#{EVENT_TYPE}”.
I also tried to put this byte array value in exec method before:
.exec(session → {
Map<String, Object> sessionAttributes = new HashMap<>();
sessionAttributes.put(“EVENT”, EventWrapperBuilder.createEvent(“INCREMENT_NUMBER”, generateRandomEventCase()).toByteArray());
return session.setAll(sessionAttributes);
})
but this again doesn’t work because in send method java compiler doesn’t allow me to use byte array serialization - java sees my session argument “#{EVENT}” as string (and if I use string.getBytes() to convert to byte array, I’m again getting constant instead of feeder value.
So, please advice if I’m doing something wrong, otherwise it seems that kafka plugin you are recommending is not capable to send protobuf message with feeder, which is industry standard. It can just send “new MyClass()” with constant values.
Any advice?
Best regards,
Mirjana