0

I'm developing a service that sends messages to a RabbitMQ instance but the connectino has to be done through a proxy.

Is there a way to configure the connection so I can set up the host and port of the proxy as you can do when using RestTemplate but for RabbitTemplate?

Any help would be really appreciated,

Regards

Victor Escobar
  • 514
  • 1
  • 6
  • 15
  • Have you tried anything so far? – iamrajshah May 07 '19 at 07:22
  • I have tried to create a new connection factory but I do not see any properties to set up a proxy properly. – Victor Escobar May 07 '19 at 07:23
  • Have you go through this ? https://stackoverflow.com/questions/3687670/using-resttemplate-how-to-send-the-request-to-a-proxy-first-so-i-can-use-my-jun – iamrajshah May 07 '19 at 07:24
  • But in this case, the connection is done different as it's done by `ConnectionFactory` interface which differs from `SimpleClientHttpRequestFactory` – Victor Escobar May 07 '19 at 07:28
  • So what actually problem you are having? – iamrajshah May 07 '19 at 07:30
  • https://docs.spring.io/spring-boot/docs/current/reference/html/howto-http-clients.html Official docmentation for creating proxy – iamrajshah May 07 '19 at 07:30
  • @iamrajshah I know how to create a proxied connection with spring boot with `RestTemplate` but in my case, I'm using `RabbitMQ` which the connection is done using a completely different template, which is `RabbitTemplate`. The constructor the rabbitmq template receives a `ConnectionFactory` instance but this does not have any parameter in order to configure a proxy. I cannot use RestTemplate as it's not a REST API, it's a amqp connection – Victor Escobar May 07 '19 at 07:34
  • You can configure in application.properties, have you tried that? – iamrajshah May 07 '19 at 07:38
  • No, you can't do that, these are the configuration properties for RabbitMQ: https://github.com/spring-projects/spring-boot/blob/v2.1.4.RELEASE/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java – Victor Escobar May 07 '19 at 08:03
  • http://candidjava.com/tutorial/spring-boot-rabbitmq-example-using-maven/ RabitMQ with application.properties – iamrajshah May 07 '19 at 08:38
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/192945/discussion-between-victor-escobar-and-iamrajshah). – Victor Escobar May 07 '19 at 08:59

0 Answers0