org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.setClientID()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.setClientID()方法的一些代码示例,展示了ActiveMQConnectionFactory.setClientID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActiveMQConnectionFactory.setClientID()方法的具体详情如下:
包路径:org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory
类名称:ActiveMQConnectionFactory
方法名:setClientID

ActiveMQConnectionFactory.setClientID介绍

暂无

代码示例

代码示例来源:origin: apache/activemq-artemis

@Test(timeout = 5000)
  public void testValidClientIdSetFactory() throws Exception {
   ActiveMQConnectionFactory activeMQConnectionFactory = (ActiveMQConnectionFactory) cf;
   activeMQConnectionFactory.setClientID("valid");
   Connection con = cf.createConnection();
   try {
     con.start();
   } finally {
     con.close();
   }
  }
}

代码示例来源:origin: apache/activemq-artemis

@Test(timeout = 5000, expected = JMSException.class)
public void testInvalidClientIdSetFactory() throws Exception {
 ActiveMQConnectionFactory activeMQConnectionFactory = (ActiveMQConnectionFactory) cf;
 activeMQConnectionFactory.setClientID("invalid");
 cf.createConnection();
}

代码示例来源:origin: apache/activemq-artemis

protected ActiveMQConnectionFactory createCoreConnectionFactory() {
 ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(brokerURL, user, password);
 if (clientID != null) {
   System.out.println("Consumer:: clientID = " + clientID);
   cf.setClientID(clientID);
 }
 try {
   Connection connection = cf.createConnection();
   connection.close();
   return cf;
 } catch (JMSSecurityException e) {
   // if a security exception will get the user and password through an input
   context.err.println("Connection failed::" + e.getMessage());
   userPassword();
   return new ActiveMQConnectionFactory(brokerURL, user, password);
 } catch (JMSException e) {
   // if a connection exception will ask for the URL, user and password
   context.err.println("Connection failed::" + e.getMessage());
   brokerURL = input("--url", "Type in the broker URL for a retry (e.g. tcp://localhost:61616)", brokerURL);
   userPassword();
   return new ActiveMQConnectionFactory(brokerURL, user, password);
 }
}

代码示例来源:origin: org.apache.activemq/artemis-cli

protected ActiveMQConnectionFactory createCoreConnectionFactory() {
 ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(brokerURL, user, password);
 if (clientID != null) {
   System.out.println("Consumer:: clientID = " + clientID);
   cf.setClientID(clientID);
 }
 try {
   Connection connection = cf.createConnection();
   connection.close();
   return cf;
 } catch (JMSSecurityException e) {
   // if a security exception will get the user and password through an input
   context.err.println("Connection failed::" + e.getMessage());
   userPassword();
   return new ActiveMQConnectionFactory(brokerURL, user, password);
 } catch (JMSException e) {
   // if a connection exception will ask for the URL, user and password
   context.err.println("Connection failed::" + e.getMessage());
   brokerURL = input("--url", "Type in the broker URL for a retry (e.g. tcp://localhost:61616)", brokerURL);
   userPassword();
   return new ActiveMQConnectionFactory(brokerURL, user, password);
 }
}

代码示例来源:origin: apache/activemq-artemis

cf.setClientID(cfConfig.getClientID());
cf.setClientFailureCheckPeriod(cfConfig.getClientFailureCheckPeriod());
cf.setConnectionTTL(cfConfig.getConnectionTTL());

代码示例来源:origin: apache/activemq-artemis

double retryIntervalMultiplier = RandomUtil.randomDouble();
int reconnectAttempts = RandomUtil.randomPositiveInt();
factory.setClientID(clientID);
factory.setUser(user);
factory.setPassword(password);

代码示例来源:origin: apache/activemq-artemis

cf.setClientID(val5);

代码示例来源:origin: org.apache.activemq/artemis-ra

cf.setClientID(val5);

代码示例来源:origin: apache/activemq-artemis

cf.setClientID(clientID);
  Assert.fail("Should throw exception");
} catch (IllegalStateException e) {

相关文章

微信公众号

最新文章

更多

ActiveMQConnectionFactory类方法