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


Java TransportConfiguration类代码示例

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


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

示例1: createEmbeddedConnectionFactory

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
private <T extends HornetQConnectionFactory> T createEmbeddedConnectionFactory(
		Class<T> factoryClass) throws Exception {
	try {
		TransportConfiguration transportConfiguration = new TransportConfiguration(
				InVMConnectorFactory.class.getName(),
				this.properties.getEmbedded().generateTransportParameters());
		ServerLocator serviceLocator = HornetQClient
				.createServerLocatorWithoutHA(transportConfiguration);
		Constructor<T> constructor = factoryClass
				.getDeclaredConstructor(HornetQProperties.class, ServerLocator.class);
		return BeanUtils.instantiateClass(constructor, this.properties,
				serviceLocator);
	}
	catch (NoClassDefFoundError ex) {
		throw new IllegalStateException("Unable to create InVM "
				+ "HornetQ connection, ensure that hornet-jms-server.jar "
				+ "is in the classpath", ex);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:HornetQConnectionFactoryFactory.java

示例2: hornetQMessageListenerContainer

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
@Bean
public MessageListenerContainer hornetQMessageListenerContainer() {
	Map<String, Object> map = new HashMap<String, Object>();
       map.put(TransportConstants.HOST_PROP_NAME, hornetq_host);  
       map.put(TransportConstants.PORT_PROP_NAME, hornetq_port);
	TransportConfiguration transportConfiguration =new TransportConfiguration(
			NettyConnectorFactory.class.getName(), map);
	
	HornetQConnectionFactory hornetQConnectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(
			JMSFactoryType.CF, transportConfiguration);
	
	DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
	container.setConnectionFactory((ConnectionFactory) hornetQConnectionFactory);
	container.setDestination(HornetQJMSClient.createTopic(IMConstant.GATEWAY_USERREGISTER_TOPIC));
	container.setPubSubDomain(true);
	container.setPubSubNoLocal(true);
	container.setMessageListener(userRegisterListener);
	container.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
	return container;
}
 
开发者ID:projectsrepos,项目名称:jim,代码行数:21,代码来源:GatewayUserRegisterConfig.java

示例3: createEmbeddedConnectionFactory

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
private <T extends HornetQConnectionFactory> T createEmbeddedConnectionFactory(
		Class<T> factoryClass) throws Exception {
	try {
		TransportConfiguration transportConfiguration = new TransportConfiguration(
				InVMConnectorFactory.class.getName(),
				this.properties.getEmbedded().generateTransportParameters());
		ServerLocator serviceLocator = HornetQClient
				.createServerLocatorWithoutHA(transportConfiguration);
		return factoryClass.getConstructor(ServerLocator.class)
				.newInstance(serviceLocator);
	}
	catch (NoClassDefFoundError ex) {
		throw new IllegalStateException("Unable to create InVM "
				+ "HornetQ connection, ensure that hornet-jms-server.jar "
				+ "is in the classpath", ex);
	}
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:18,代码来源:HornetQConnectionFactoryFactory.java

示例4: isAnotherInstanceRunning

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
/**
 * check if another instance of ioFabric is running
 *
 * @return boolean
 */
private static boolean isAnotherInstanceRunning() {
	Map<String, Object> connectionParams = new HashMap<>();
	connectionParams.put("port", 55555);
	connectionParams.put("host", "localhost");

	ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(
			new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams));
	try {
		sf = serverLocator.createSessionFactory();
	} catch (Exception e) {
		return false;
	}

	return true;
}
 
开发者ID:iotracks,项目名称:iofabric,代码行数:21,代码来源:Start.java

示例5: fromAuthorities

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
public static <T extends HornetQConnectionFactory> T fromAuthorities(
        @NonNull Class<T> factoryClass, @NonNull String authorities) throws Exception {
    List<TransportConfiguration> configs = Arrays.stream(authorities.split(",")).map(
            String::toLowerCase).map(String::trim).map(TransportConfigurations::fromAuthority)
            .collect(Collectors.toList());

    Constructor<T> constructor = factoryClass.getConstructor(boolean.class,
            TransportConfiguration[].class);
    return constructor.newInstance(true, Iterables.toArray(configs,
            TransportConfiguration.class));
}
 
开发者ID:Mercateo,项目名称:mercateo-spring-boot-starter-hornetq-cluster,代码行数:12,代码来源:HornetQConnectionFactories.java

示例6: fromAuthority

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
public static TransportConfiguration fromAuthority(@NonNull String authority) {
    String[] hostAndPort = authority.split(":");
    checkArgument(hostAndPort.length == 2);
    checkArgument(!hostAndPort[0].isEmpty());
    checkArgument(!hostAndPort[1].isEmpty());
    return new TransportConfiguration(NettyConnectorFactory.class.getName(), ImmutableMap.of(
            TransportConstants.HOST_PROP_NAME, hostAndPort[0],
            TransportConstants.PORT_PROP_NAME, hostAndPort[1]));
}
 
开发者ID:Mercateo,项目名称:mercateo-spring-boot-starter-hornetq-cluster,代码行数:10,代码来源:TransportConfigurations.java

示例7: mustCreateTransportConfigurationsAccordingToAuthorities

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
@Test
public void mustCreateTransportConfigurationsAccordingToAuthorities() throws Exception {
    ClusteredHornetQProperties twoAuthorities = new ClusteredHornetQProperties();
    twoAuthorities.setAuthorities("foo:8888,bar:9999");
    ClusteredHornetQConnectionFactoryFactory uut = spy(
            new ClusteredHornetQConnectionFactoryFactory(mockBeanFactory, twoAuthorities));
    HornetQConnectionFactory connectionFactory = uut.createConnectionFactory(factoryClass);
    TransportConfiguration[] staticConnectors = connectionFactory.getStaticConnectors();
    assertEquals(2, staticConnectors.length);
    assertEquals("foo", staticConnectors[0].getParams().get("host"));
    assertEquals("8888", staticConnectors[0].getParams().get("port"));
    assertEquals("bar", staticConnectors[1].getParams().get("host"));
    assertEquals("9999", staticConnectors[1].getParams().get("port"));
}
 
开发者ID:Mercateo,项目名称:mercateo-spring-boot-starter-hornetq-cluster,代码行数:15,代码来源:ClusteredHornetQConnectionFactoryFactory0Test.java

示例8: fromAuthorityGoodCase

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
@Test
public void fromAuthorityGoodCase() throws Exception {
    TransportConfiguration transportConfiguration = TransportConfigurations.fromAuthority(
            "somehost:12345");
    assertEquals("somehost", transportConfiguration.getParams().get("host"));
    assertEquals("12345", transportConfiguration.getParams().get("port"));
    assertEquals(NettyConnectorFactory.class.getName(), transportConfiguration
            .getFactoryClassName());
}
 
开发者ID:Mercateo,项目名称:mercateo-spring-boot-starter-hornetq-cluster,代码行数:10,代码来源:TransportConfigurations0Test.java

示例9: mustContainTransportConfigurationToOneGivenAuthority

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
@Test
public void mustContainTransportConfigurationToOneGivenAuthority() throws Exception {
    HornetQConnectionFactory connectionFactory = HornetQConnectionFactories.fromAuthorities(
            HornetQConnectionFactory.class, "somehost:12345");
    TransportConfiguration[] staticConnectors = connectionFactory.getStaticConnectors();
    assertEquals(1, staticConnectors.length);
    assertEquals("somehost", staticConnectors[0].getParams().get("host"));
    assertEquals("12345", staticConnectors[0].getParams().get("port"));
}
 
开发者ID:Mercateo,项目名称:mercateo-spring-boot-starter-hornetq-cluster,代码行数:10,代码来源:HornetQConnectionFactories0Test.java

示例10: mustContainTransportConfigurationToTwoGivenAuthorities

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
@Test
public void mustContainTransportConfigurationToTwoGivenAuthorities() throws Exception {
    HornetQConnectionFactory connectionFactory = HornetQConnectionFactories.fromAuthorities(
            HornetQConnectionFactory.class, "foo:8888,bar:9999");
    TransportConfiguration[] staticConnectors = connectionFactory.getStaticConnectors();
    assertEquals(2, staticConnectors.length);
    assertEquals("foo", staticConnectors[0].getParams().get("host"));
    assertEquals("8888", staticConnectors[0].getParams().get("port"));
    assertEquals("bar", staticConnectors[1].getParams().get("host"));
    assertEquals("9999", staticConnectors[1].getParams().get("port"));
}
 
开发者ID:Mercateo,项目名称:mercateo-spring-boot-starter-hornetq-cluster,代码行数:12,代码来源:HornetQConnectionFactories0Test.java

示例11: createConfiguration

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
public Configuration createConfiguration() {
	ConfigurationImpl configuration = new ConfigurationImpl();
	configuration.setSecurityEnabled(false);
	configuration.setPersistenceEnabled(this.properties.isPersistent());

	String dataDir = getDataDir();

	// HORNETQ-1302
	configuration.setJournalDirectory(dataDir + "/journal");

	if (this.properties.isPersistent()) {
		configuration.setJournalType(JournalType.NIO);
		configuration.setLargeMessagesDirectory(dataDir + "/largemessages");
		configuration.setBindingsDirectory(dataDir + "/bindings");
		configuration.setPagingDirectory(dataDir + "/paging");
	}

	TransportConfiguration transportConfiguration = new TransportConfiguration(
			InVMAcceptorFactory.class.getName(),
			this.properties.generateTransportParameters());
	configuration.getAcceptorConfigurations().add(transportConfiguration);

	// HORNETQ-1143
	if (this.properties.isDefaultClusterPassword()) {
		logger.debug("Using default HornetQ cluster password: "
				+ this.properties.getClusterPassword());
	}

	configuration.setClusterPassword(this.properties.getClusterPassword());
	return configuration;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:32,代码来源:HornetQEmbeddedConfigurationFactory.java

示例12: createNativeConnectionFactory

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
private <T extends HornetQConnectionFactory> T createNativeConnectionFactory(
		Class<T> factoryClass) throws Exception {
	Map<String, Object> params = new HashMap<String, Object>();
	params.put(TransportConstants.HOST_PROP_NAME, this.properties.getHost());
	params.put(TransportConstants.PORT_PROP_NAME, this.properties.getPort());
	TransportConfiguration transportConfiguration = new TransportConfiguration(
			NettyConnectorFactory.class.getName(), params);
	Constructor<T> constructor = factoryClass.getDeclaredConstructor(
			HornetQProperties.class, boolean.class, TransportConfiguration[].class);
	return BeanUtils.instantiateClass(constructor, this.properties, false,
			new TransportConfiguration[] { transportConfiguration });
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:HornetQConnectionFactoryFactory.java

示例13: assertInVmConnectionFactory

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
private TransportConfiguration assertInVmConnectionFactory(
		HornetQConnectionFactory connectionFactory) {
	TransportConfiguration transportConfig = getSingleTransportConfiguration(
			connectionFactory);
	assertThat(transportConfig.getFactoryClassName())
			.isEqualTo(InVMConnectorFactory.class.getName());
	return transportConfig;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:HornetQAutoConfigurationTests.java

示例14: assertNettyConnectionFactory

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
private TransportConfiguration assertNettyConnectionFactory(
		HornetQConnectionFactory connectionFactory, String host, int port) {
	TransportConfiguration transportConfig = getSingleTransportConfiguration(
			connectionFactory);
	assertThat(transportConfig.getFactoryClassName())
			.isEqualTo(NettyConnectorFactory.class.getName());
	assertThat(transportConfig.getParams().get("host")).isEqualTo(host);
	assertThat(transportConfig.getParams().get("port")).isEqualTo(port);
	return transportConfig;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:HornetQAutoConfigurationTests.java

示例15: getSingleTransportConfiguration

import org.hornetq.api.core.TransportConfiguration; //导入依赖的package包/类
private TransportConfiguration getSingleTransportConfiguration(
		HornetQConnectionFactory connectionFactory) {
	TransportConfiguration[] transportConfigurations = connectionFactory
			.getServerLocator().getStaticTransportConfigurations();
	assertThat(transportConfigurations.length).isEqualTo(1);
	return transportConfigurations[0];
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:HornetQAutoConfigurationTests.java


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