[rabbitmq-discuss] Problem With Distribute load Using HAproxy ?
jayesh dalwadi
jayeshdalwadi2007 at gmail.com
Sat May 12 06:25:27 BST 2012
hello
i create HAproxy TCP Base load balance but problem is when i publish
message using that load balancer that time my connection establish to
one node and that node hava all the message
example
i create two node of RabbitMQ its behind HAproxy loadbalncer and when
i start my publisher program that time my publish message not get
distributed between that nodes only one node get all the message
how can i distribute my publish message to different node can any body
give suggestion that how can it possible
my publisher program is
public class RabbitMQ {
private static ConnectionFactory factory = new ConnectionFactory();
private static Connection connection;
private static Channel channel;
public static void main(String args[]){
try {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("192.168.137.1");
factory.setPort(5672);
connection= factory.newConnection();
channel = connection.createChannel();
Map<String, Object> args1 = new HashMap<String, Object>();
args1.put("x-ha-policy", "all");
channel.queueDeclare("Queue1",false, false, false, args1);
channel.queueDeclare("Queue2",false, false, false, args1);
channel.exchangeDeclare("test1","direct");
channel.queueBind("Queue1","test1", "ex1");
channel.queueBind("Queue2","test1", "ex2");
for (int i=0;i<100000;i++){
channel.basicPublish("test1","ex2",MessageProperties.PERSISTENT_TEXT_PLAIN,"test
message".getBytes());
}
}catch (IOException e) {
e.printStackTrace();
}
}
}
More information about the rabbitmq-discuss
mailing list