• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ActiveMQClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.activemq.artemis.api.core.client.ActiveMQClient的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQClient类的具体用法?Java ActiveMQClient怎么用?Java ActiveMQClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ActiveMQClient类属于org.apache.activemq.artemis.api.core.client包,在下文中一共展示了ActiveMQClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createEmbeddedConnectionFactory

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
private <T extends ActiveMQConnectionFactory> T createEmbeddedConnectionFactory(
		Class<T> factoryClass) throws Exception {
	try {
		TransportConfiguration transportConfiguration = new TransportConfiguration(
				InVMConnectorFactory.class.getName(),
				this.properties.getEmbedded().generateTransportParameters());
		ServerLocator serviceLocator = ActiveMQClient
				.createServerLocatorWithoutHA(transportConfiguration);
		return factoryClass.getConstructor(ServerLocator.class)
				.newInstance(serviceLocator);
	}
	catch (NoClassDefFoundError ex) {
		throw new IllegalStateException("Unable to create InVM "
				+ "Artemis connection, ensure that artemis-jms-server.jar "
				+ "is in the classpath", ex);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:ArtemisConnectionFactoryFactory.java


示例2: performCoreManagement

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
public void performCoreManagement(ManagementCallback<ClientMessage> cb) throws Exception {

      try (ActiveMQConnectionFactory factory = createConnectionFactory();
         ServerLocator locator = factory.getServerLocator();
           ClientSessionFactory sessionFactory = locator.createSessionFactory();
           ClientSession session = sessionFactory.createSession(user, password, false, true, true, false, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE)) {
         session.start();
         ClientRequestor requestor = new ClientRequestor(session, "activemq.management");
         ClientMessage message = session.createMessage(false);

         cb.setUpInvocation(message);

         ClientMessage reply = requestor.request(message);

         if (ManagementHelper.hasOperationSucceeded(reply)) {
            cb.requestSuccessful(reply);
         } else {
            cb.requestFailed(reply);
         }
      }
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:AbstractAction.java


示例3: testShutdownPoolInUse

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testShutdownPoolInUse() throws Exception {
   ActiveMQClient.setGlobalThreadPoolProperties(10, 1);
   ActiveMQClient.clearThreadPools();

   final CountDownLatch inUse = new CountDownLatch(1);
   final CountDownLatch neverLeave = new CountDownLatch(1);

   ActiveMQClient.getGlobalThreadPool().execute(new Runnable() {
      @Override
      public void run() {
         System.err.println("Hello!");
         try {
            inUse.countDown();
            neverLeave.await();
         } catch (Exception e) {
            e.printStackTrace();
            neverLeave.countDown();
         }
      }
   });

   Assert.assertTrue(inUse.await(10, TimeUnit.SECONDS));
   ActiveMQClient.clearThreadPools(100, TimeUnit.MILLISECONDS);
   Assert.assertTrue(neverLeave.await(10, TimeUnit.SECONDS));
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:ClientThreadPoolsTest.java


示例4: setUp

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
   locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(InVMConnectorFactory.class.getCanonicalName()));
   testDir = temporaryFolder.getRoot().getAbsolutePath();

   LegacyLDAPSecuritySettingPlugin legacyLDAPSecuritySettingPlugin = new LegacyLDAPSecuritySettingPlugin();
   Map<String, String> map = new HashMap<>();
   map.put(LegacyLDAPSecuritySettingPlugin.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
   map.put(LegacyLDAPSecuritySettingPlugin.CONNECTION_URL, "ldap://localhost:1024");
   map.put(LegacyLDAPSecuritySettingPlugin.CONNECTION_USERNAME, "uid=admin,ou=system");
   map.put(LegacyLDAPSecuritySettingPlugin.CONNECTION_PASSWORD, "secret");
   map.put(LegacyLDAPSecuritySettingPlugin.CONNECTION_PROTOCOL, "s");
   map.put(LegacyLDAPSecuritySettingPlugin.AUTHENTICATION, "simple");
   map.put(LegacyLDAPSecuritySettingPlugin.ENABLE_LISTENER, "true");
   legacyLDAPSecuritySettingPlugin.init(map);

   ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("LDAPLogin");
   Configuration configuration = new ConfigurationImpl().setSecurityEnabled(true).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName())).setJournalDirectory(ActiveMQTestBase.getJournalDir(testDir, 0, false)).setBindingsDirectory(ActiveMQTestBase.getBindingsDir(testDir, 0, false)).setPagingDirectory(ActiveMQTestBase.getPageDir(testDir, 0, false)).setLargeMessagesDirectory(ActiveMQTestBase.getLargeMessagesDir(testDir, 0, false)).setPersistenceEnabled(false).addSecuritySettingPlugin(legacyLDAPSecuritySettingPlugin);

   server = ActiveMQServers.newActiveMQServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager, false);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:LegacyLDAPSecuritySettingPluginListenerTest.java


示例5: setup

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Before
public void setup() throws Exception {
   server = createServer(true);
   server.start();

   server.waitForActivation(10, TimeUnit.SECONDS);

   ServerLocator sl = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
   sessionFactory = sl.createSessionFactory();

   addSessionFactory(sessionFactory);

   addressInfo = new AddressInfo(baseAddress);
   addressInfo.addRoutingType(RoutingType.MULTICAST);
   server.addOrUpdateAddressInfo(addressInfo);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:MulticastTest.java


示例6: main

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
public static void main(final String[] args) throws Exception {
   try {
      CrashClient.log.debug("args = " + Arrays.asList(args));

      ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName()));
      locator.setClientFailureCheckPeriod(ClientCrashTest.PING_PERIOD);
      locator.setConnectionTTL(ClientCrashTest.CONNECTION_TTL);
      ClientSessionFactory sf = locator.createSessionFactory();

      ClientSession session = sf.createSession(false, true, true);
      ClientProducer producer = session.createProducer(ClientCrashTest.QUEUE);

      // it has to be durable otherwise it may race dying before the client is killed
      ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, true, 0, System.currentTimeMillis(), (byte) 1);
      message.getBodyBuffer().writeString(ClientCrashTest.MESSAGE_TEXT_FROM_CLIENT);

      producer.send(message);

      // exit without closing the session properly
      System.exit(9);
   } catch (Throwable t) {
      CrashClient.log.error(t.getMessage(), t);
      System.exit(1);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:CrashClient.java


示例7: createQueue

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
private void createQueue(final String queueAddress, final String queueName, SubscriptionDurability durability) throws ActiveMQException, Exception {
	final TransportConfiguration inVMTransportConfig = new TransportConfiguration(InVMConnectorFactory.class.getName());
	try (ServerLocator loc = ActiveMQClient.createServerLocatorWithoutHA(inVMTransportConfig)) {
		try (ClientSessionFactory sf = loc.createSessionFactory()) {
			try (ClientSession session = sf.createSession()) {
				final QueueQuery queryResults = session.queueQuery(new SimpleString(queueName));
				if (!queryResults.isExists()) {
					switch (durability) {
					case TEMPORARY:
						// If we created a temporary queue here, it'd be removed right after closing the ClientSession:
						// there's no point. Only clients may create temporary queues (e.g. through their Consumer).
						LOGGER.warn("Only a client may create a temporary queue: ignoring request");
						break;
					case DURABLE:
					case DEFAULT:
						session.createQueue(queueAddress, queueName, durability == SubscriptionDurability.DURABLE);
						break;
					default:
						throw new IllegalArgumentException("Unknown subscription durability " + durability);
					}
					session.commit();
				}
			}
		}
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:27,代码来源:HawkThriftIface.java


示例8: testOneWaySSL

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testOneWaySSL() throws Exception {
   createCustomSslServer();
   String text = RandomUtil.randomString();

   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
   ClientSession session = addClientSession(sf.createSession(false, true, true));
   session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false);
   ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE));

   ClientMessage message = createTextMessage(session, text);
   producer.send(message);

   ClientConsumer consumer = addClientConsumer(session.createConsumer(CoreClientOverOneWaySSLTest.QUEUE));
   session.start();

   ClientMessage m = consumer.receive(1000);
   Assert.assertNotNull(m);
   Assert.assertEquals(text, m.getBodyBuffer().readString());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:CoreClientOverOneWaySSLTest.java


示例9: testOneWaySSLUsingDefaultSslContext

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testOneWaySSLUsingDefaultSslContext() throws Exception {
   createCustomSslServer();
   String text = RandomUtil.randomString();

   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.USE_DEFAULT_SSL_CONTEXT_PROP_NAME, true);

   SSLContext.setDefault(SSLSupport.createContext(TransportConstants.DEFAULT_KEYSTORE_PROVIDER, TransportConstants.DEFAULT_KEYSTORE_PATH, TransportConstants.DEFAULT_KEYSTORE_PASSWORD, storeType, CLIENT_SIDE_TRUSTSTORE, PASSWORD));

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
   ClientSession session = addClientSession(sf.createSession(false, true, true));
   session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false);
   ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE));

   ClientMessage message = createTextMessage(session, text);
   producer.send(message);

   ClientConsumer consumer = addClientConsumer(session.createConsumer(CoreClientOverOneWaySSLTest.QUEUE));
   session.start();

   ClientMessage m = consumer.receive(1000);
   Assert.assertNotNull(m);
   Assert.assertEquals(text, m.getBodyBuffer().readString());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:CoreClientOverOneWaySSLTest.java


示例10: testOneWaySSLVerifyHostNegative

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testOneWaySSLVerifyHostNegative() throws Exception {
   createCustomSslServer(null, null, false);
   String text = RandomUtil.randomString();

   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
   tc.getParams().put(TransportConstants.VERIFY_HOST_PROP_NAME, true);

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));

   try {
      ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
      fail("Creating a session here should fail due to a certificate with a CN that doesn't match the host name.");
   } catch (Exception e) {
      // ignore
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:CoreClientOverOneWaySSLTest.java


示例11: testOneWaySSLWithBadServerCipherSuite

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testOneWaySSLWithBadServerCipherSuite() throws Exception {
   createCustomSslServer("myBadCipherSuite", null);
   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   try {
      createSessionFactory(locator);
      Assert.fail();
   } catch (ActiveMQNotConnectedException e) {
      Assert.assertTrue(true);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:CoreClientOverOneWaySSLTest.java


示例12: testOneWaySSLWithMismatchedCipherSuites

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testOneWaySSLWithMismatchedCipherSuites() throws Exception {
   createCustomSslServer(getEnabledCipherSuites()[0], "TLSv1.2");
   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
   tc.getParams().put(TransportConstants.ENABLED_CIPHER_SUITES_PROP_NAME, getEnabledCipherSuites()[1]);
   tc.getParams().put(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, "TLSv1.2");

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   try {
      createSessionFactory(locator);
      Assert.fail();
   } catch (ActiveMQNotConnectedException e) {
      Assert.assertTrue(true);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:CoreClientOverOneWaySSLTest.java


示例13: testOneWaySSLWithBadServerProtocol

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testOneWaySSLWithBadServerProtocol() throws Exception {
   createCustomSslServer(null, "myBadProtocol");
   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   try {
      createSessionFactory(locator);
      Assert.fail();
   } catch (ActiveMQNotConnectedException e) {
      Assert.assertTrue(true);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:CoreClientOverOneWaySSLTest.java


示例14: testOneWaySSLWithMismatchedProtocols

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testOneWaySSLWithMismatchedProtocols() throws Exception {
   createCustomSslServer(null, "TLSv1");
   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
   tc.getParams().put(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, "TLSv1.2");

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   try {
      createSessionFactory(locator);
      Assert.fail();
   } catch (ActiveMQNotConnectedException e) {
      Assert.assertTrue(true);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:CoreClientOverOneWaySSLTest.java


示例15: testPOODLE

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
// http://www.oracle.com/technetwork/topics/security/poodlecve-2014-3566-2339408.html
public void testPOODLE() throws Exception {
   createCustomSslServer(null, "SSLv3");
   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
   tc.getParams().put(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, "SSLv3");

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   try {
      createSessionFactory(locator);
      Assert.fail();
   } catch (ActiveMQNotConnectedException e) {
      Assert.assertTrue(true);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:CoreClientOverOneWaySSLTest.java


示例16: createConnectionEntry

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Override
public ConnectionEntry createConnectionEntry(Acceptor acceptorUsed, Connection remotingConnection) {
   AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(this, remotingConnection, server.getExecutorFactory().getExecutor(), server);
   long ttl = ActiveMQClient.DEFAULT_CONNECTION_TTL;

   if (server.getConfiguration().getConnectionTTLOverride() != -1) {
      ttl = server.getConfiguration().getConnectionTTLOverride();
   }

   String id = server.getConfiguration().getName();
   boolean useCoreSubscriptionNaming = server.getConfiguration().isAmqpUseCoreSubscriptionNaming();
   AMQPConnectionContext amqpConnection = new AMQPConnectionContext(this, connectionCallback, id, (int) ttl, getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), true, null, null);

   Executor executor = server.getExecutorFactory().getExecutor();

   ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(this, amqpConnection, remotingConnection, executor);
   delegate.addFailureListener(connectionCallback);
   delegate.addCloseListener(connectionCallback);

   connectionCallback.setProtonConnectionDelegate(delegate);

   ConnectionEntry entry = new ConnectionEntry(delegate, executor, System.currentTimeMillis(), ttl);

   return entry;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:ProtonProtocolManager.java


示例17: testOneWaySSLWithIncorrectTrustStorePath

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testOneWaySSLWithIncorrectTrustStorePath() throws Exception {
   createCustomSslServer();
   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, "incorrect path");
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   try {
      ClientSessionFactory sf = createSessionFactory(locator);
      Assert.fail();
   } catch (ActiveMQNotConnectedException se) {
      //ok
   } catch (ActiveMQException e) {
      fail("Invalid Exception type:" + e.getType());
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:CoreClientOverOneWaySSLTest.java


示例18: testPlainConnectionToSSLEndpoint

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testPlainConnectionToSSLEndpoint() throws Exception {
   createCustomSslServer();
   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, false);

   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)).setCallTimeout(2000);
   try {
      createSessionFactory(locator);
      fail("expecting exception");
   } catch (ActiveMQNotConnectedException se) {
      //ok
   } catch (ActiveMQConnectionTimedOutException ctoe) {
      //ok
   } catch (ActiveMQException e) {
      fail("Invalid Exception type:" + e.getType());
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:CoreClientOverOneWaySSLTest.java


示例19: testCoreClientWithGlobalThreadPoolParamtersChanged

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testCoreClientWithGlobalThreadPoolParamtersChanged() throws Exception {

   int originalScheduled = ActiveMQClient.getGlobalScheduledThreadPoolSize();
   int originalGlobal = ActiveMQClient.getGlobalThreadPoolSize();

   try {
      ActiveMQClient.setGlobalThreadPoolProperties(2, 1);
      ActiveMQClient.clearThreadPools();
      ServerLocator locator = createNonHALocator(false);
      testCoreClient(true, locator);
   } finally {
      // restoring original value otherwise future tests would be screwed up
      ActiveMQClient.setGlobalThreadPoolProperties(originalGlobal, originalScheduled);
      ActiveMQClient.clearThreadPools();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:CoreClientTest.java


示例20: testConnectionTimeoutConfig

import org.apache.activemq.artemis.api.core.client.ActiveMQClient; //导入依赖的package包/类
@Test
public void testConnectionTimeoutConfig() throws Exception {
   final int timeout = 23456;
   TransportConfiguration transport = new TransportConfiguration(NETTY_CONNECTOR_FACTORY);
   transport.getParams().put(TransportConstants.NETTY_CONNECT_TIMEOUT, timeout);

   ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(transport);

   ClientSessionFactoryImpl factory = (ClientSessionFactoryImpl) locator.createSessionFactory();
   NettyConnector connector = (NettyConnector) factory.getConnector();

   Bootstrap bootstrap = connector.getBootStrap();

   assertEquals(timeout, bootstrap.register().channel().config().getConnectTimeoutMillis());

   factory.close();
   locator.close();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:NettyConnectorTest.java



注:本文中的org.apache.activemq.artemis.api.core.client.ActiveMQClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TraceClassVisitor类代码示例发布时间:2022-05-22
下一篇:
Java Transcripts类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap