Hi, I’ve been looking at the documentation at Correlation Identifier (confluent.io) and while I think I get it, the second code snippet doesn’t make sense to me. It says:
ProducerRecord<String, String> responseEvent = new ProducerRecord<>("response-event-key", "response-event-value");
requestEvent.headers().add("requestID", requestEvent.headers().lastHeader("requestID").value());
requestEvent.send(producerRecord);
Here it’s creating a responseEvent but never using it, which seems wrong to me, however I want to be sure I’m not missing some fundamental piece of understanding as I would have thought it should read:
ProducerRecord<String, String> responseEvent = new ProducerRecord<>("response-event-key", "response-event-value");
responseEvent.headers().add("requestID", requestEvent.headers().lastHeader("requestID").value());
responseEvent.send(producerRecord);
Can someone clarify for me please?