要为RabbitMQ发送测试设置哪个主机

要为RabbitMQ发送测试设置哪个主机,rabbitmq,Rabbitmq,所以我很难理解如何使用rabbitmq。我使用以下Send.java类RabbitMQ发送消息: 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";

所以我很难理解如何使用rabbitmq。我使用以下Send.java类RabbitMQ发送消息:

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 a connection to the server
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("WHAT DO I PUT HERE"); // <==========================What do I put here??
        Connection connection = factory.newConnection();
        // next we create a channel, which is where most of the API
        // for getting things done resides
        Channel channel = connection.createChannel();

        // to send we must declare a queue for us to send to; then
        // we can publish a message to the 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();
    }
}
导入com.rabbitmq.client.ConnectionFactory;
导入com.rabbitmq.client.Connection;
导入com.rabbitmq.client.Channel;
公共类发送{
私有最终静态字符串队列\u NAME=“hello”;
公共静态void main(字符串[]argv)引发java.io.IOException{
//创建到服务器的连接
ConnectionFactory工厂=新的ConnectionFactory();

setHost(“我在这里放什么”);//这真的是不言自明的…此方法设置用于连接的默认主机。 如果您在本地计算机上使用RabbitMQ,可以如下设置:

factory.setHost("localhost");
或者:

factory.setHost("127.0.0.1");

将其设置为运行rabbitMQ服务器的主机