0

I am trying to perform Request/Response Pattern with Micronaut AMQP, with below diagram

enter image description here

Producer

  @RabbitClient(ProductTopicConstants.FETE_BIRD_EXCHANGE)
    @RabbitProperty(name = "replyTo", value = "amq.rabbitmq.reply-to") 
    public interface IProductProducer {
        @Binding(ProductTopicConstants.GET_FREE_TEXT_SEARCH)
        Flowable<Product> findFreeText(String text);
    }

Listener

@RabbitListener
public class ProductListener {
@Queue(ProductTopicConstants.GET_FREE_TEXT_SEARCH)
    public Flowable<Product> findByFreeText(String text) {
        LOG.info(String.format("Listener --> Listening value = %s", text));
        return Flowable.fromPublisher(repository.getCollection("product", Product.class)
                .find(new Document("$text",
                        new Document("$search", text)
                                .append("$caseSensitive", false)
                                .append("$diacriticSensitive", false)
                )));
    }}

For the request it is working, find how do I perform the response back to the controller and how to implement this pattern asynchronously with a message broker using the AMQP protocol and micronaut.

San Jaisy
  • 15,327
  • 34
  • 171
  • 290
  • could you explain a little bit more, what sense your picture makes? i eighter got it wrong or there is something wrong? – IEE1394 Nov 16 '20 at 20:49
  • @IEE1394 I am trying to achieve the response from the listener method to the producer method as per this document https://micronaut-projects.github.io/micronaut-rabbitmq/latest/guide/#rpc But I always get an time out exception – San Jaisy Nov 18 '20 at 03:32
  • all i found is that one: https://medium.com/@pulkitswarup/microservices-asynchronous-request-response-pattern-6d00ab78abb6 which works quite differently to your picture – IEE1394 Nov 22 '20 at 11:54

0 Answers0