what host to set for RabbitMQ send test -


so having trouble understanding how use rabbitmq. have following send.java class using rabbitmq send message:

import com.rabbitmq.client.connectionfactory; import com.rabbitmq.client.connection; import com.rabbitmq.client.channel;  public class send {     private final static string queue_name = "hello";      public static void main(string[] argv) throws java.io.ioexception {         // create connection server         connectionfactory factory = new connectionfactory();         factory.sethost("what put here"); // <==========================what put here??         connection connection = factory.newconnection();         // next create channel, of api         // getting things done resides         channel channel = connection.createchannel();          // send must declare queue send to;         // can publish message queue:         channel.queuedeclare(queue_name, false, false, false, null);         string message = "hello world!";         channel.basicpublish("", queue_name, null, message.getbytes());         system.out.println(" [x] sent '" + message + "'");          channel.close();         connection.close();     } } 

i don't understand can set host make run java application. can explain? thanks!

it's self-explanatory... method sets default host use connection. if you're using rabbitmq on local machine can set this:

factory.sethost("localhost"); 

or alternatively:

factory.sethost("127.0.0.1"); 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -