Forum Discussion
Humashankar
2 months agoChampion Level 2
You're on the right track using MessageExchange to access messages in ReadyAPI, but there's a refined difference when working with Kafka compared to traditional requests and responses.
The "null object" error occurs because messageExchange.getResponse() is designed for retrieving responses in a request-response flow, which doesn't apply to subscribing to a Kafka topic.
Try using a Groovy Script assertion in your "Receive Message" test step to access the received Kafka messages. Specifically, utilize messageExchange.getMessageBodies() to retrieve a list of messages, allowing you to effectively handle the Kafka message exchange.
Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards
Related Content
- 3 years ago