使用Broker开启内置MQ服务器:
public static void main(String[] args) throws Exception{ BrokerService brokerService = new BrokerService(); //设置占用的端口号 brokerService.setUseJmx(true); //使用jms协议 brokerService.addConnector("tcp://localhost:61616"); //打开连接 brokerService.start(); }