本文整理汇总了Java中org.apache.activemq.broker.TransportConnector类的典型用法代码示例。如果您正苦于以下问题:Java TransportConnector类的具体用法?Java TransportConnector怎么用?Java TransportConnector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransportConnector类属于org.apache.activemq.broker包,在下文中一共展示了TransportConnector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Before
@Override
public void setUp() throws Exception {
super.setUp();
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
brokerService.setAdvisorySupport(false);
brokerService.setSchedulerSupport(false);
TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
brokerService.start();
connectionUri = connector.getPublishableConnectString();
factory = new ActiveMQConnectionFactory(connectionUri);
pooledFactory = new JmsPoolConnectionFactory();
pooledFactory.setConnectionFactory(factory);
pooledFactory.setMaxConnections(1);
pooledFactory.setBlockIfSessionPoolIsFull(false);
pooledFactory.setMaximumActiveSessionPerConnection(1);
}
示例2: setUp
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
brokerService.setAdvisorySupport(false);
brokerService.setSchedulerSupport(false);
TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
brokerService.start();
connectionUri = connector.getPublishableConnectString();
factory = new ActiveMQConnectionFactory(connectionUri);
pooledFactory = new JmsPoolConnectionFactory();
pooledFactory.setConnectionFactory(factory);
pooledFactory.setMaxConnections(1);
pooledFactory.setBlockIfSessionPoolIsFull(false);
pooledFactory.setUseAnonymousProducers(false);
}
示例3: setUp
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setUseJmx(true);
brokerService.getManagementContext().setCreateConnector(false);
brokerService.setAdvisorySupport(false);
brokerService.setSchedulerSupport(false);
TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
brokerService.start();
connectionUri = connector.getPublishableConnectString();
factory = new ActiveMQConnectionFactory(connectionUri);
pooledFactory = new JmsPoolConnectionFactory();
pooledFactory.setConnectionFactory(factory);
pooledFactory.setMaxConnections(1);
pooledFactory.setBlockIfSessionPoolIsFull(false);
}
示例4: setUp
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
brokerService.setSchedulerSupport(false);
brokerService.setAdvisorySupport(false);
TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
brokerService.start();
connectionUri = connector.getPublishableConnectString();
factory = new ActiveMQConnectionFactory(connectionUri);
pooledFactory = new JmsPoolConnectionFactory();
pooledFactory.setConnectionFactory(factory);
pooledFactory.setMaxConnections(1);
pooledFactory.setBlockIfSessionPoolIsFull(true);
pooledFactory.setBlockIfSessionPoolIsFullTimeout(500);
pooledFactory.setMaximumActiveSessionPerConnection(1);
}
示例5: setUp
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
brokerService = new BrokerService();
brokerService.setUseJmx(false);
brokerService.setPersistent(false);
brokerService.setSchedulerSupport(false);
brokerService.setAdvisorySupport(false);
TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
brokerService.start();
factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false");
pooledFactory = new JmsPoolConnectionFactory();
pooledFactory.setConnectionFactory(factory);
}
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:17,代码来源:PooledConnectionFactoryWithTemporaryDestinationsTest.java
示例6: setUp
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
brokerService = new BrokerService();
brokerService.setUseJmx(false);
brokerService.setPersistent(false);
brokerService.setSchedulerSupport(false);
brokerService.setAdvisorySupport(false);
TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
brokerService.start();
factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri());
pooledFactory = new JmsPoolConnectionFactory();
pooledFactory.setConnectionFactory(factory);
pooledFactory.setMaxConnections(1);
}
示例7: setUp
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
this.plugin = new KalinkaClusterPlugin(this.connectionStore, this.clientIdResolver);
this.customizedBroker = new EmbeddedActiveMQBroker() {
@Override
protected void configure() {
try {
final TransportConnector connector = new TransportConnector();
connector.setUri(new URI("mqtt://localhost:1883"));
connector.setName("mqtt");
this.getBrokerService().addConnector(connector);
this.getBrokerService().setPlugins(new BrokerPlugin[] { plugin });
} catch (final Exception e) {
e.printStackTrace();
}
}
};
this.customizedBroker.start();
}
示例8: configureTransportConnectors
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
/**
* Configure <code>TransporConnectors</code> lazily
* @return List<TransportConnector>
* @throws URISyntaxException
*/
private List<TransportConnector> configureTransportConnectors() throws URISyntaxException{
List<TransportConnector> transportConnectors = new ArrayList<>();
// iterate the connectorNames
for(String name : connectorNames){
TransportConnector tc = new TransportConnector();
// construct URI string
String uri = name + "://" +
cfg.getProperty(name+"."+CONNECTOR_HOST, CONNECTOR_HOST_VALUE)
+ ":" + cfg.getProperty(name+"."+CONNECTOR_PORT, CONNECTOR_PORT_VALUE);
tc.setName(name);
tc.setUri(new URI(uri));
// add the transport
transportConnectors.add(tc);
}
return transportConnectors;
}
示例9: stop
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
/**
* Stopping ActiveMQ embedded broker
*
* @return true if broker is successfully stopped
*/
public boolean stop() {
try {
log.info(" ************* Stopping **************");
if (broker.isStarted()) {
broker.stop();
for (TransportConnector transportConnector : transportConnectors) {
transportConnector.stop();
}
setBrokerStatus(false);
}
return true;
} catch (Exception e) {
log.error("Error while shutting down the broker", e);
return false;
}
}
示例10: startActiveMQServer
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
private void startActiveMQServer()
{
try
{
final BrokerService broker = new BrokerService();
// broker.getPersistenceAdapter().setDirectory(arg0);
final TransportConnector connector = new TransportConnector();
connector.setUri(new URI(ACTIVEMQ_URL));
broker.addConnector(connector);
broker.start();
System.out.println("ActiveMQ started");
}
catch (Exception e)
{
throw new RuntimeException("Cannot start ActiveMQ server", e);
}
}
示例11: main
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
public static void main(String[] args)
{
//
// Start ActiveMQ server
try
{
final BrokerService broker = new BrokerService();
final TransportConnector connector = new TransportConnector();
connector.setUri(new URI(url));
broker.addConnector(connector);
broker.start();
System.out.println("ActiveMQ started on " + connector.getUri());
}
catch (Exception e)
{
throw new RuntimeException("Cannot start ActiveMQ server", e);
}
}
示例12: startActiveMQServer
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
private void startActiveMQServer()
{
try
{
final BrokerService broker = new BrokerService();
// broker.getPersistenceAdapter().setDirectory(arg0);
final TransportConnector connector = new TransportConnector();
connector.setUri(new URI(ACTIVEMQ_URL));
broker.addConnector(connector);
broker.start();
System.out.println("ActiveMQ started and listens to " + ACTIVEMQ_URL);
}
catch (Exception e)
{
throw new RuntimeException("Cannot start ActiveMQ server", e);
}
}
示例13: addConnection
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
/**
* Overridden to allow for authentication using different Jaas
* configurations depending on if the connection is SSL or not.
*
* @param context The context for the incoming Connection.
* @param info The ConnectionInfo Command representing the incoming
* connection.
*/
@Override
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
if (context.getSecurityContext() == null) {
boolean isSSL;
Connector connector = context.getConnector();
if (connector instanceof TransportConnector) {
TransportConnector transportConnector = (TransportConnector) connector;
isSSL = transportConnector.getServer().isSslServer();
} else {
isSSL = false;
}
if (isSSL) {
this.sslBroker.addConnection(context, info);
} else {
this.nonSslBroker.addConnection(context, info);
}
super.addConnection(context, info);
}
}
示例14: removeConnection
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
/**
* Overriding removeConnection to make sure the security context is cleaned.
*/
@Override
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
boolean isSSL;
Connector connector = context.getConnector();
if (connector instanceof TransportConnector) {
TransportConnector transportConnector = (TransportConnector) connector;
isSSL = (transportConnector.getServer() instanceof SslTransportServer);
} else {
isSSL = false;
}
super.removeConnection(context, info, error);
if (isSSL) {
this.sslBroker.removeConnection(context, info, error);
} else {
this.nonSslBroker.removeConnection(context, info, error);
}
}
示例15: validateBroker
import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
private boolean validateBroker(String host) {
boolean result = true;
if (BROKERS.containsKey(host) || SERVERS.containsKey(host) || CONNECTORS.containsKey(host)) {
// check the broker is still in the BrokerRegistry
TransportConnector connector = CONNECTORS.get(host);
if (BrokerRegistry.getInstance().lookup(host) == null
|| (connector != null && connector.getBroker().isStopped())) {
result = false;
// clean-up
BROKERS.remove(host);
SERVERS.remove(host);
if (connector != null) {
CONNECTORS.remove(host);
if (connector != null) {
ServiceSupport.dispose(connector);
}
}
}
}
return result;
}