org.apache.activemq.ActiveMQConnectionFactory.getBrokerURL()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(123)

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

ActiveMQConnectionFactory.getBrokerURL介绍

暂无

代码示例

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

props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync()));
if (getBrokerURL() != null) {
  props.setProperty(Context.PROVIDER_URL, getBrokerURL());
  props.setProperty("brokerURL", getBrokerURL());

代码示例来源:origin: com.github.hqstevenson.junit/activemq-junit

public String getBrokerURL() {
  return connectionFactory.getBrokerURL();
}

代码示例来源:origin: epam/Wilma

private void turnOffConnectionErrorLog(final Exception e) {
  if (logConnectionError) {
    logger.info("Wilma could not connect to Indexer JMS Queue @" + connectionFactory.getBrokerURL(), e);
    //turn off logging connection errors to avoid duplicate errors in Wilma log
    logConnectionError = false;
  }
}

代码示例来源:origin: epam/Wilma

private void turnOnConnectionErrorLog() {
    if (!logConnectionError) {
      logger.info("Wilma successfully connected to Indexer JMS Queue @" + connectionFactory.getBrokerURL());
      logConnectionError = true;
    }
  }
}

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

public boolean isMatchingConnectionFactory(ConnectionFactory connectionFactory, JMSURLHelper jmsURL, HashMap properties) {
    String brokerURL = null;

    if (connectionFactory instanceof ActiveMQConnectionFactory) {
      ActiveMQConnectionFactory amqConnectionFactory = (ActiveMQConnectionFactory)connectionFactory;

      // get existing queue connection factory properties
      brokerURL = amqConnectionFactory.getBrokerURL();
    }

    // compare broker url
    String propertyBrokerURL = (String)properties.get(BROKER_URL);
    if (brokerURL == null || !brokerURL.equals(propertyBrokerURL)) {
      return false;
    }
    return true;
  }
}

代码示例来源:origin: com.github.hqstevenson.junit/activemq-junit

/**
 * Invoked by JUnit to setup the client resource.
 */
@Override
protected void before() throws Throwable {
  log.info("Starting {}: {}", this.getClass().getSimpleName(), connectionFactory.getBrokerURL());
  this.start();
  super.before();
}

代码示例来源:origin: com.github.hqstevenson.junit/activemq-junit

/**
 * Invoked by JUnit to tear down the client resource.
 */
@Override
protected void after() {
  log.info("Stopping {}: {}", this.getClass().getSimpleName(), connectionFactory.getBrokerURL());
  super.after();
  this.stop();
}

代码示例来源:origin: com.github.hqstevenson.junit/activemq-junit

/**
 * Manually start the Client.
 */
public void start() {
  try {
    try {
      connection = connectionFactory.createConnection();
      String clientId = getClientId();
      if (clientId != null) {
        connection.setClientID(clientId);
      }
      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      createClient();
    } catch (JMSException jmsEx) {
      throw new RuntimeException("Producer initialization failed" + this.getClass().getSimpleName(), jmsEx);
    }
    connection.start();
  } catch (JMSException jmsEx) {
    throw new IllegalStateException("Producer failed to start", jmsEx);
  }
  log.info("Ready to produce messages to {}", connectionFactory.getBrokerURL());
}

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

props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync()));
if (getBrokerURL() != null) {
  props.setProperty(Context.PROVIDER_URL, getBrokerURL());
  props.setProperty("brokerURL", getBrokerURL());

代码示例来源:origin: pierre/meteo

props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync()));
if (getBrokerURL() != null) {
  props.setProperty(Context.PROVIDER_URL, getBrokerURL());
  props.setProperty("brokerURL", getBrokerURL());

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

props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync()));
if (getBrokerURL() != null) {
  props.setProperty(Context.PROVIDER_URL, getBrokerURL());
  props.setProperty("brokerURL", getBrokerURL());

代码示例来源:origin: epam/Wilma

@BeforeMethod
public void setUp() {
  MockitoAnnotations.initMocks(this);
  given(connectionFactory.getBrokerURL()).willReturn("");
}

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

props.setProperty("dispatchAsync", Boolean.toString(isDispatchAsync()));
if (getBrokerURL() != null) {
  props.setProperty(Context.PROVIDER_URL, getBrokerURL());
  props.setProperty("brokerURL", getBrokerURL());

代码示例来源:origin: trellis-ldp/trellis

@Test
  public void testGetJmsFactory() {
    final NotificationsConfiguration c = new NotificationsConfiguration();
    c.setConnectionString("localhost:61616");

    final ActiveMQConnectionFactory factory1 = AppUtils.getJmsFactory(c);
    assertNull(factory1.getUserName(), "Unexpected username!");
    assertNull(factory1.getPassword(), "Unexpected password!");
    assertEquals("localhost:61616", factory1.getBrokerURL(), "Incorrect broker URL!");

    c.set("password", "pass");
    final ActiveMQConnectionFactory factory2 = AppUtils.getJmsFactory(c);
    assertNull(factory2.getUserName(), "Unexpected username!");
    assertNull(factory2.getPassword(), "Unexpected password!");
    assertEquals("localhost:61616", factory2.getBrokerURL(), "Incorrect broker URL!");

    c.set("username", "user");
    final ActiveMQConnectionFactory factory3 = AppUtils.getJmsFactory(c);
    assertEquals("user", factory3.getUserName(), "Incorrect username!");
    assertEquals("pass", factory3.getPassword(), "Incorrect password!");
    assertEquals("localhost:61616", factory3.getBrokerURL(), "Incorrect broker URL!");
  }
}

相关文章

微信公众号

最新文章

更多

ActiveMQConnectionFactory类方法