Jesse created AMQ-6971:
--------------------------
Summary: 使用udp 协议时 当Active MQ server 在云服务器上,connection.start()会超时
Key: AMQ-6971
URL: https://issues.apache.org/jira/browse/AMQ-6971
Project: ActiveMQ
Issue Type: Bug
Components: Connector
Affects Versions: 5.15.3
Environment: 消息队列服务: active mq==5.15.3
运行环境:
openjdk version "1.8.0_162"
OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)
java 客户端连接 jdk版本:jdk-10.0.1_windows-x64_bin.exe
运行环境:Windows10 64bit
Reporter: Jesse
Attachments: src.zip
activemq.xml 文件:
udp协议传输配置 <transportConnector name="udp" uri="udp://0.0.0.0:9010"/>
java 客户端连接器code:
import org.apache.activemq.ActiveMQConnectionFactory;
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.Session;
public class MQConnector implements ErrorCode {
public static Destination destination;
public static Connection connection;
public static Session session;
//尝试连接队列服务若成功 生成一个MessageConsumer接口对应的类型,其中包含发送信息的方法;
public int connect(String url, String topic) throws Exception {
try {
// Create a ConnectionFactory
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(url);
// Create a Connection
connection = connectionFactory.createConnection();
connection.start();
// Create a Session
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Create the destination (Topic or Queue)
destination = session.createQueue(topic);
//返回错误值
return CONNECT_SUCCESS;
} catch (Exception e) {
//打印错误
System.out.println("Caught connect error:" + e);
e.printStackTrace();
return CONNECT_ERROR;
}
}
}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)