💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
~~~ public class Send { private final static String QUEUE_NAME = "simple_queue"; public static void main(String[] args) throws Exception { //获取连接 Connection connection = ConnectionUtil.getConn(); // 创建通道 Channel channel = connection.createChannel(); // 声明队列 channel.queueDeclare(QUEUE_NAME, false, false, false, null); // 向指定的队列中发送消息 String message = "hello rabbitmq"; channel.basicPublish("", QUEUE_NAME, null, message.getBytes()); System.out.println("send message " +message); // 关闭通道和连接 channel.close(); connection.close(); } } ~~~