Sample code for request/reply design by using Spring Cloud Stream

@giri is correct, request-reply isn’t explicitly supported in Spring Cloud Stream but you can kind of roll your own.

I haven’t yet done it myself, but it should work if you do this (I don’t think I’m missing anything…):

  • Use the solace_correlationId and solace_replyTo headers
  • Have you requestor pre-define a replyTo topic space and subscribe to it…for example: domain/app/app-instance/reply/> (Follow topic best practices that you can find elsewhere)
  • Set the solace_correlationId to a unique value and the solace_replyToin the msg header to something like domain/app/app-instance/reply/<correlation-id>
  • Have the replier respond to the solace_replyTo topic using the “dynamic publishing” capabilities of spring cloud stream which you can learn more about in this codelab. I’d probably use the BindersHeaders.TARGET_DESTINATION option since each response would be on a unique topic…no reason to have spring cache the channel info.

Hope that helps!