rabbitmq client connect server

rabbitmq client connect server
通过java client链接server@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
1. 通过设置参数
1  ConnectionFactory factory  =   new  ConnectionFactory();
2  factory.setUsername(userName);
3  factory.setPassword(password);
4  factory.setVirtualHost(virtualHost);
5  factory.setHost(hostName);
6  factory.setPort(portNumber);
7  Connection conn  =  factory.newConnection();
2.通过
 AMQP URIs
1  ConnectionFactory factory  =   new  ConnectionFactory();
2  factory.setUri( " amqp://userName:password@hostName:portNumber/virtualHost " );
3  Connection conn  =  factory.newConnection();
3.多地址
1  Address[] addrArr  =   new  Address[]{  new  Address(hostname1, portnumber1)
2                                   ,  new  Address(hostname2, portnumber2)};
3  Connection conn  =  factory.newConnection(addrArr);







你可能感兴趣的:(rabbitmq client connect server)