当前位置: 首页>>代码示例>>Java>>正文


Java ActiveMQConnectionFactory.getDiscoveryGroupConfiguration方法代码示例

本文整理汇总了Java中org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.getDiscoveryGroupConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQConnectionFactory.getDiscoveryGroupConfiguration方法的具体用法?Java ActiveMQConnectionFactory.getDiscoveryGroupConfiguration怎么用?Java ActiveMQConnectionFactory.getDiscoveryGroupConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory的用法示例。


在下文中一共展示了ActiveMQConnectionFactory.getDiscoveryGroupConfiguration方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRemoteCFWithJgroupsWithTransportConfigFile

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testRemoteCFWithJgroupsWithTransportConfigFile() throws Exception {
   Hashtable<String, String> props = new Hashtable<>();
   props.put(Context.INITIAL_CONTEXT_FACTORY, org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory.class.getCanonicalName());
   props.put("connectionFactory.myConnectionFactory", "jgroups://testChannelName?file=test-jgroups-file_ping.xml&" +
      ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
      ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
   Context ctx = new InitialContext(props);

   ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");

   DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
   Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
   Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());

   BroadcastEndpoint broadcastEndpoint = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory().createBroadcastEndpoint();
   Assert.assertTrue(broadcastEndpoint instanceof JGroupsFileBroadcastEndpoint);
   broadcastEndpoint.close(false);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:SimpleJNDIClientTest.java

示例2: testRemoteCFWithJgroupsWithTransportConfigProps

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testRemoteCFWithJgroupsWithTransportConfigProps() throws Exception {
   Hashtable<String, String> props = new Hashtable<>();
   props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
   props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?properties=param=value&" +
      ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
      ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
   Context ctx = new InitialContext(props);

   ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");

   DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
   Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
   Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());

   BroadcastEndpointFactory broadcastEndpointFactory = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
   Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
   JGroupsPropertiesBroadcastEndpointFactory endpointFactory = (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
   Assert.assertEquals(endpointFactory.getProperties(), "param=value");
   Assert.assertEquals(endpointFactory.getChannelName(), "testChannelName");
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:SimpleJNDIClientTest.java

示例3: testRemoteCFWithJgroupsWithTransportConfigNullProps

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testRemoteCFWithJgroupsWithTransportConfigNullProps() throws Exception {
   Hashtable<String, String> props = new Hashtable<>();
   props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
   props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?" +
      ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
      ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
   Context ctx = new InitialContext(props);

   ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");

   DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
   Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
   Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());

   BroadcastEndpointFactory broadcastEndpointFactory = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
   Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
   JGroupsPropertiesBroadcastEndpointFactory endpointFactory = (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
   Assert.assertEquals(endpointFactory.getProperties(), null);
   Assert.assertEquals(endpointFactory.getChannelName(), "testChannelName");
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:SimpleJNDIClientTest.java

示例4: testRemoteCFWithUDPWithTransportConfig

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testRemoteCFWithUDPWithTransportConfig() throws NamingException, JMSException {
   Hashtable<String, String> props = new Hashtable<>();
   props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
   props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort() + "?" +
      TransportConstants.LOCAL_ADDRESS_PROP_NAME + "=Server1&" +
      TransportConstants.LOCAL_PORT_PROP_NAME + "=1198&" +
      ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
      ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
   Context ctx = new InitialContext(props);

   ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");

   DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
   Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
   Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());

   UDPBroadcastEndpointFactory udpBroadcastEndpointFactory = (UDPBroadcastEndpointFactory) discoveryGroupConfiguration.getBroadcastEndpointFactory();
   //these 2 are transient so are ignored
   Assert.assertNotEquals("Server1", udpBroadcastEndpointFactory.getLocalBindAddress());
   Assert.assertNotEquals(1198, udpBroadcastEndpointFactory.getLocalBindPort());
   Assert.assertEquals(getUDPDiscoveryAddress(), udpBroadcastEndpointFactory.getGroupAddress());
   Assert.assertEquals(getUDPDiscoveryPort(), udpBroadcastEndpointFactory.getGroupPort());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:SimpleJNDIClientTest.java

示例5: testConnectionFactoryUDP

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testConnectionFactoryUDP() throws Exception {
   createDiscoveryFactoryUDP();
   cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory");

   // apparently looking up the connection factory with the org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory
   // is not enough to actually serialize it so we serialize it manually
   byte[] x = serialize(cf);
   ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class);
   checkEquals(cf, y);
   DiscoveryGroupConfiguration dgc = y.getDiscoveryGroupConfiguration();
   Assert.assertEquals(dgc.getName(), "dg1");
   Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5000);
   Assert.assertEquals(dgc.getRefreshTimeout(), 5000);
   Assert.assertTrue(dgc.getBroadcastEndpointFactory() instanceof UDPBroadcastEndpointFactory);
   UDPBroadcastEndpointFactory befc = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
   Assert.assertEquals(Integer.parseInt(System.getProperty("org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory.localBindPort", "-1")), befc.getLocalBindPort());
   Assert.assertEquals(System.getProperty("org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory.localBindAddress"), befc.getLocalBindAddress());
   Assert.assertEquals(getUDPDiscoveryPort(), befc.getGroupPort());
   Assert.assertEquals(getUDPDiscoveryAddress(), befc.getGroupAddress());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:ConnectionFactorySerializationTest.java

示例6: testConnectionFactoryJgroupsFile

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testConnectionFactoryJgroupsFile() throws Exception {
   createDiscoveryFactoryJGroupsFile();
   cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory");

   // apparently looking up the connection factory with the org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory
   // is not enough to actually serialize it so we serialize it manually
   byte[] x = serialize(cf);
   ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class);
   checkEquals(cf, y);
   DiscoveryGroupConfiguration dgc = y.getDiscoveryGroupConfiguration();
   Assert.assertEquals(dgc.getName(), "dg1");
   Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5000);
   Assert.assertEquals(dgc.getRefreshTimeout(), 5000);
   Assert.assertTrue(dgc.getBroadcastEndpointFactory() instanceof JGroupsFileBroadcastEndpointFactory);
   JGroupsFileBroadcastEndpointFactory befc = (JGroupsFileBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
   Assert.assertEquals("myChannel", befc.getChannelName());
   Assert.assertEquals("/META-INF/myfile.xml", befc.getFile());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:ConnectionFactorySerializationTest.java

示例7: testConnectionFactoryJgroupsProperties

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testConnectionFactoryJgroupsProperties() throws Exception {
   createDiscoveryFactoryJGroupsProperties();
   cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory");

   // apparently looking up the connection factory with the org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory
   // is not enough to actually serialize it so we serialize it manually
   byte[] x = serialize(cf);
   ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class);
   checkEquals(cf, y);
   DiscoveryGroupConfiguration dgc = y.getDiscoveryGroupConfiguration();
   Assert.assertEquals(dgc.getName(), "dg1");
   Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5000);
   Assert.assertEquals(dgc.getRefreshTimeout(), 5000);
   Assert.assertTrue(dgc.getBroadcastEndpointFactory() instanceof JGroupsPropertiesBroadcastEndpointFactory);
   JGroupsPropertiesBroadcastEndpointFactory befc = (JGroupsPropertiesBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
   Assert.assertEquals("myChannel", befc.getChannelName());
   Assert.assertEquals("param=1,param2=2", befc.getProperties());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:ConnectionFactorySerializationTest.java

示例8: internalNewURI

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Override
protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception {
   DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
   BroadcastEndpointFactory endpoint = dgc.getBroadcastEndpointFactory();
   String auth;
   if (endpoint instanceof JGroupsFileBroadcastEndpointFactory) {
      auth = ((JGroupsFileBroadcastEndpointFactory) endpoint).getChannelName();
   } else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory) {
      auth = ((JGroupsPropertiesBroadcastEndpointFactory) endpoint).getChannelName();
   } else {
      throw new NotSerializableException(endpoint + "not serializable");
   }
   String query = BeanSupport.getData(null, bean, dgc, endpoint);
   dgc.setBroadcastEndpointFactory(endpoint);
   return new URI(SchemaConstants.JGROUPS, null, auth, -1, null, query, null);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:JGroupsSchema.java

示例9: testJGroupsFileURI

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testJGroupsFileURI() throws Exception {
   DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
   JGroupsFileBroadcastEndpointFactory endpointFactory = new JGroupsFileBroadcastEndpointFactory().setChannelName("channel-name").setFile("channel-file.xml");
   discoveryGroupConfiguration.setName("foo").setRefreshTimeout(12345).setDiscoveryInitialWaitTimeout(5678).setBroadcastEndpointFactory(endpointFactory);
   ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
   URI tcp = parser.createSchema("jgroups", connectionFactoryWithHA);
   ActiveMQConnectionFactory factory = parser.newObject(tcp, null);
   DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
   Assert.assertNotNull(dgc);
   BroadcastEndpointFactory befc = dgc.getBroadcastEndpointFactory();
   Assert.assertNotNull(befc);
   Assert.assertTrue(befc instanceof JGroupsFileBroadcastEndpointFactory);
   Assert.assertEquals(dgc.getName(), "foo");
   Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5678);
   Assert.assertEquals(dgc.getRefreshTimeout(), 12345);
   JGroupsFileBroadcastEndpointFactory fileBroadcastEndpointFactory = (JGroupsFileBroadcastEndpointFactory) befc;
   Assert.assertEquals(fileBroadcastEndpointFactory.getFile(), "channel-file.xml");
   Assert.assertEquals(fileBroadcastEndpointFactory.getChannelName(), "channel-name");

   BeanUtilsBean bean = new BeanUtilsBean();
   checkEquals(bean, connectionFactoryWithHA, factory);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:ConnectionFactoryURITest.java

示例10: testJGroupsPropertiesURI

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testJGroupsPropertiesURI() throws Exception {
   DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
   JGroupsPropertiesBroadcastEndpointFactory endpointFactory = new JGroupsPropertiesBroadcastEndpointFactory().setChannelName("channel-name").setProperties("param=val,param2-val2");
   discoveryGroupConfiguration.setName("foo").setRefreshTimeout(12345).setDiscoveryInitialWaitTimeout(5678).setBroadcastEndpointFactory(endpointFactory);
   ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
   URI tcp = parser.createSchema("jgroups", connectionFactoryWithHA);
   ActiveMQConnectionFactory factory = parser.newObject(tcp, null);
   DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
   Assert.assertNotNull(dgc);
   BroadcastEndpointFactory broadcastEndpointFactory = dgc.getBroadcastEndpointFactory();
   Assert.assertNotNull(broadcastEndpointFactory);
   Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
   Assert.assertEquals(dgc.getName(), "foo");
   Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5678);
   Assert.assertEquals(dgc.getRefreshTimeout(), 12345);
   JGroupsPropertiesBroadcastEndpointFactory propertiesBroadcastEndpointFactory = (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
   Assert.assertEquals(propertiesBroadcastEndpointFactory.getProperties(), "param=val,param2-val2");
   Assert.assertEquals(propertiesBroadcastEndpointFactory.getChannelName(), "channel-name");

   BeanUtilsBean bean = new BeanUtilsBean();
   checkEquals(bean, connectionFactoryWithHA, factory);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:ConnectionFactoryURITest.java

示例11: internalNewURI

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Override
protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception {
   DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
   UDPBroadcastEndpointFactory endpoint = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
   String query = BeanSupport.getData(UDPServerLocatorSchema.IGNORED, bean, dgc, endpoint);
   dgc.setBroadcastEndpointFactory(endpoint);
   return new URI(SchemaConstants.UDP, null, endpoint.getGroupAddress(), endpoint.getGroupPort(), null, query, null);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:UDPSchema.java

示例12: testUDPURI

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Test
public void testUDPURI() throws Exception {
   DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
   UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory();
   endpoint.setGroupPort(3333).setGroupAddress("wahey").setLocalBindPort(555).setLocalBindAddress("uhuh");
   discoveryGroupConfiguration.setName("foo").setRefreshTimeout(12345).setDiscoveryInitialWaitTimeout(5678).setBroadcastEndpointFactory(endpoint);
   ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
   URI tcp = parser.createSchema("udp", connectionFactoryWithHA);

   ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(tcp.toString());
   DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
   Assert.assertNotNull(dgc);
   BroadcastEndpointFactory befc = dgc.getBroadcastEndpointFactory();
   Assert.assertNotNull(befc);
   Assert.assertTrue(befc instanceof UDPBroadcastEndpointFactory);
   UDPBroadcastEndpointFactory ubgc = (UDPBroadcastEndpointFactory) befc;
   Assert.assertEquals("wahey", ubgc.getGroupAddress());
   Assert.assertEquals(3333, ubgc.getGroupPort());

   //these 2 are transient
   // These will take the System.properties used on the testsuite,
   // for that reason we take them as != instead of checking for null
   Assert.assertNotEquals("uhuh", ubgc.getLocalBindAddress());
   Assert.assertNotEquals(555, ubgc.getLocalBindPort());

   Assert.assertEquals("foo", dgc.getName());
   Assert.assertEquals(5678, dgc.getDiscoveryInitialWaitTimeout());
   Assert.assertEquals(12345, dgc.getRefreshTimeout());

   BeanUtilsBean bean = new BeanUtilsBean();
   checkEquals(bean, connectionFactoryWithHA, factory);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:33,代码来源:ConnectionFactoryURITest.java


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