Прокси в Java-клиенте Rabbitmq ⇐ JAVA
-
Anonymous
Прокси в Java-клиенте Rabbitmq
Is there any way to set a proxy to a RabbitMQ Java client?
package com.rabbitmq; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.MessageProperties; public class SendToRabbitMQ { private final static String QUEUE_NAME = "observation_queue"; public static void sendObservation(String observation) { try { ConnectionFactory factory = new ConnectionFactory(); factory.setHost("x.x.x.x"); factory.setUsername("test"); factory.setVirtualHost("test_vh"); factory.setPassword("test"); Connection con = factory.newConnection(); Channel channel = con.createChannel(); channel.queueDeclare(QUEUE_NAME, true, false, false, null); channel.basicPublish( "", QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, observation.getBytes()); System.out.println(" Ovservation Sent '" + observation + "'"); channel.close(); con.close(); } catch (Exception e) { e.printStackTrace(); } } } I want to set a proxy for this Connection.
Источник: https://stackoverflow.com/questions/366 ... ava-client
Is there any way to set a proxy to a RabbitMQ Java client?
package com.rabbitmq; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.MessageProperties; public class SendToRabbitMQ { private final static String QUEUE_NAME = "observation_queue"; public static void sendObservation(String observation) { try { ConnectionFactory factory = new ConnectionFactory(); factory.setHost("x.x.x.x"); factory.setUsername("test"); factory.setVirtualHost("test_vh"); factory.setPassword("test"); Connection con = factory.newConnection(); Channel channel = con.createChannel(); channel.queueDeclare(QUEUE_NAME, true, false, false, null); channel.basicPublish( "", QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, observation.getBytes()); System.out.println(" Ovservation Sent '" + observation + "'"); channel.close(); con.close(); } catch (Exception e) { e.printStackTrace(); } } } I want to set a proxy for this Connection.
Источник: https://stackoverflow.com/questions/366 ... ava-client
Мобильная версия