javax.jms.Connection.getClientID()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(129)

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

Connection.getClientID介绍

[英]Gets the client identifier for this connection.

This value is specific to the JMS provider. It is either preconfigured by an administrator in a ConnectionFactory object or assigned dynamically by the application by calling the setClientID method.
[中]获取此连接的客户端标识符。
此值特定于JMS提供程序。它由管理员在ConnectionFactory对象中预配置,或由应用程序通过调用setClientID方法动态分配。

代码示例

代码示例来源:origin: openzipkin/brave

@Override public String getClientID() throws JMSException {
 return delegate.getClientID();
}

代码示例来源:origin: spring-projects/spring-framework

String currentClientId = getConnection().getClientID();
if (currentClientId != null && currentClientId.equals(args[0])) {
  return null;

代码示例来源:origin: bitronix/btm

@Override
public String getClientID() throws JMSException {
  return nonXaConnection.getClientID();
}

代码示例来源:origin: org.apache.openejb/openejb-core

@Override
public String getClientID() throws JMSException {
  return con.getClientID();
}

代码示例来源:origin: org.codehaus.btm/btm

public String getClientID() throws JMSException {
  return nonXaConnection.getClientID();
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

@Override
public String getClientID() throws JMSException {
  return nonXaConnection.getClientID();
}

代码示例来源:origin: com.bbossgroups.rpc/bboss-rpc

public String getClientID() throws JMSException
{
  
  return con.getClientID();
}

代码示例来源:origin: com.axway.ats.framework/ats-actionlibrary

@Override
public String getClientID() throws JMSException {
  return connection.getClientID();
}

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

@Override
public String getClientID() throws JMSException {
  return getConnection().getClientID();
}

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

@Override
public String getClientID() throws JMSException {
  return getConnection().getClientID();
}

代码示例来源:origin: org.jboss.pnc/messaging

@PostConstruct
public void init() {
  try {
    connection = connectionFactory.createConnection();
    logger.info("JMS client ID {}.", connection.getClientID());
    logger.info("JMSXPropertyNames {}.", connection.getMetaData().getJMSXPropertyNames());
  } catch (Exception e) {
    logger.error("Failed to initialize JMS.", e);
  }
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public String getClientID() {
  try {
    return connection().getClientID();
  } catch (final JMSException e) {
    throw toRuntimeException(e);
  }
}

代码示例来源:origin: com.github.mrharibo.micronet/mn-network

public String getConnectionID() {
    try {
      return TrimConnectionID(connection.getClientID());
    } catch (JMSException e) {
      e.printStackTrace();
      return null;
    }
  }
}

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

@Override
public void setClientID(String clientID) throws JMSException {
  // ignore repeated calls to setClientID() with the same client id
  // this could happen when a JMS component such as Spring that uses a
  // PooledConnectionFactory shuts down and reinitializes.
  if (this.getConnection().getClientID() == null || !this.getClientID().equals(clientID)) {
    getConnection().setClientID(clientID);
  }
}

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

@Override
public void setClientID(String clientID) throws JMSException {
  // ignore repeated calls to setClientID() with the same client id
  // this could happen when a JMS component such as Spring that uses a
  // PooledConnectionFactory shuts down and reinitializes.
  if (this.getConnection().getClientID() == null || !this.getClientID().equals(clientID)) {
    getConnection().setClientID(clientID);
  }
}

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

@Test
public void testGetSetConnectionFactory() throws Exception {
 conn = cf.createConnection();
 conn.getClientID();
 conn.setClientID("somethingElse");
}

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

@Test
public void testNoClientIDConfigured_1() throws Exception {
 // the ConnectionFactories that ship with ActiveMQ Artemis do not have their clientID
 // administratively configured.
 deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_XA_FALSE", "/CF_XA_FALSE");
 ConnectionFactory cf = (ConnectionFactory) ic.lookup("/CF_XA_FALSE");
 Connection c = cf.createConnection();
 ProxyAssertSupport.assertNull(c.getClientID());
 c.close();
 undeployConnectionFactory("CF_XA_FALSE");
}

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

@Test
public void testGetClientID() throws Exception {
 Connection connection = createConnection();
 String clientID = connection.getClientID();
 // We don't currently set client ids on the server, so this should be null.
 // In the future we may provide connection factories that set a specific client id
 // so this may change
 ProxyAssertSupport.assertNull(clientID);
 connection.close();
}

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

@Test
public void testNoClientIDConfigured_2() throws Exception {
 // the ConnectionFactories that ship with ActiveMQ Artemis do not have their clientID
 // administratively configured.
 deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_XA_FALSE", "/CF_XA_FALSE");
 ConnectionFactory cf = (ConnectionFactory) ic.lookup("/CF_XA_FALSE");
 Connection c = cf.createConnection();
 // set the client id immediately after the connection is created
 c.setClientID(testClientId);
 ProxyAssertSupport.assertEquals(testClientId, c.getClientID());
 c.close();
 undeployConnectionFactory("CF_XA_FALSE");
}

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

/**
* Try setting client ID
*/
@Test
public void testSetClientID() throws Exception {
 Connection conn = createConnection();
 conn.setClientID("myID");
 String clientID = conn.getClientID();
 ProxyAssertSupport.assertEquals("Invalid ClientID", "myID", clientID);
}

相关文章