0
votes

When using the ReplyingKafkaTemplate to get synchronous response, I have encountered the following error.

"""[TaskScheduler-1] o.s.k.r.ReplyingKafkaTemplate : Reply timed out for: ProducerRecord(topic=cinfo-request, partition=null, headers=RecordHeaders(headers = [RecordHeader(key = kafka_replyTopic, value = [99, 105, 110, 102, 111, 45, 114, 101, 112, 108, 121]), RecordHeader(key = kafka_correlationId, """

Normally when there is a timeout exception it will say timed out trying to connect to XYZ. This message is really not enough to explain what is wrong. Is there any way to turn on debug logging for Spring-Kafka to get a better idea what is going on here? I need to get this ready for production and such an error happening in production without more information available is very concerning.

Update full error message:

2020-07-06 09:46:18.553 ERROR 18218 --- [nio-9398-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.util.concurrent.ExecutionException: org.springframework.kafka.core.KafkaProducerException: Failed to send; nested exception is org.apache.kafka.common.errors.UnknownServerException: The server experienced an unexpected error when processing the request.] with root cause

org.apache.kafka.common.errors.UnknownServerException: The server experienced an unexpected error when processing the request.

2020-07-06 09:46:23.521 WARN 18218 --- [TaskScheduler-1] o.s.k.r.ReplyingKafkaTemplate : Reply timed out for: ProducerRecord(topic=student, partition=null, headers=RecordHeaders(headers = [RecordHeader(key = kafka_replyTopic, value = [114, 101, 115, 117, 108, 116]), RecordHeader(key = kafka_correlationId, value = [-93, 59, 85, -117, -71, 109, 66, -115, -117, -16, 79, 123, -120, -4, -90, -107]), RecordHeader(key = TypeId, value = [99, 111, 109, 46, 97, 115, 98, 46, 101, 120, 97, 109, 112, 108, 101, 46, 83, 116, 117, 100, 101, 110, 116])], isReadOnly = true), key=STD101, value=com.asb.example.Student@762dbd5f, timestamp=null) with correlationId: [-123310123018425907456692533262240930155]

1

1 Answers

0
votes

Reply timed out for:...

This message is really not enough to explain what is wrong.

??

It simply means the request was sent, but the reply wasn't received in time; it's hard to see how adding debug logging on the client side will help; the template is simply waiting for thee reply.

You can increase the timeout (the default is 5 seconds) but you should look on the server side to see why the reply is not being sent, if you expect it within that time.