Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-6971

使用udp 协议时 当Active MQ server 在云服务器上,connection.start()会超时

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Invalid
    • Affects Version/s: 5.15.3
    • Fix Version/s: None
    • Component/s: Connector
    • Labels:
      None
    • Environment:
    • Flags:
      Important

      Description

      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; }

      }
      }

        Attachments

        1. src.zip
          3 kB
          Jesse

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kelelelelele Jesse
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: