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


Java BrokerService.addConnector方法代码示例

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


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

示例1: startBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
  broker = new BrokerService();
  broker.setUseJmx(false);
  broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
  broker.addConnector(BROKER_URL);
  broker.setBrokerName("localhost");
  broker.setPopulateJMSXUserID(true);
  broker.setUseAuthenticatedPrincipalForJMSXUserID(true);

  // enable authentication
  List<AuthenticationUser> users = new ArrayList<>();
  // username and password to use to connect to the broker.
  // This user has users privilege (able to browse, consume, produce, list destinations)
  users.add(new AuthenticationUser(USERNAME, PASSWORD, "users"));
  SimpleAuthenticationPlugin plugin = new SimpleAuthenticationPlugin(users);
  BrokerPlugin[] plugins = new BrokerPlugin[]{ plugin };
  broker.setPlugins(plugins);

  broker.start();

  // create JMS connection factory
  connectionFactory = new ActiveMQConnectionFactory(BROKER_URL);
  connectionFactoryWithoutPrefetch =
      new ActiveMQConnectionFactory(BROKER_URL + "?jms.prefetchPolicy.all=0");
}
 
开发者ID:apache,项目名称:beam,代码行数:27,代码来源:JmsIOTest.java

示例2: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的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);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:21,代码来源:PooledSessionExhaustionTest.java

示例3: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的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);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:22,代码来源:PooledSessionNoPublisherCachingTest.java

示例4: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的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);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:22,代码来源:PooledSessionTest.java

示例5: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的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);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:22,代码来源:PooledSessionExhaustionBlockTimeoutTest.java

示例6: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的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

示例7: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的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);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:18,代码来源:PooledConnectionExpiryEvictsFromPoolTest.java

示例8: ServerSide

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public ServerSide() {
    try {
        //This message broker is embedded
        BrokerService broker = new BrokerService();
        broker.setPersistent(false);
        broker.setUseJmx(false);
        broker.addConnector(messageBrokerUrl);
        broker.start();
    } catch (Exception e) {
        //Handle the exception appropriately
    }
    QueueConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
    //Delegating the handling of messages to another class, instantiate it before setting up JMS so it
    //is ready to handle messages
    this.messageProtocol = new MessageProtocol();
    this.setupMessageQueueConsumer(connectionFactory);
}
 
开发者ID:mariaklimenko,项目名称:jeta,代码行数:18,代码来源:ServerSide.java

示例9: initServerConfig

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
void initServerConfig(final MockedServerConfigDTO config) throws MockServerException {
    logger.debug("initServerConfig called");

    try {

        // Configure the MQ broker
        synchronized (monitor) {
            broker = new BrokerService();
            broker.setPersistent(false);
            broker.setUseJmx(false);
            broker.addConnector(config.getNativeProperties().get("BROKER_URL") + config.getPort());
        }

        connectionFactory = new ActiveMQConnectionFactory(config.getNativeProperties().get("BROKER_URL") + config.getPort());
        connectionFactory.setMaxThreadPoolSize(config.getMaxThreads());
        connectionFactory.setRejectedTaskHandler(new ThreadPoolExecutor.CallerRunsPolicy());

    } catch (Throwable ex) {
        throw new MockServerException(ex);
    }

}
 
开发者ID:mgtechsoftware,项目名称:smockin,代码行数:23,代码来源:MockedJmsServerEngine.java

示例10: createBrokerService

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private BrokerService createBrokerService(final String name) {
    final BrokerService broker = new BrokerService();
    broker.setPersistent(persistent);
    broker.setBrokerName(name);
    broker.setStartAsync(false);
    tempDir = Files.createTempDir();
    broker.setDataDirectoryFile(tempDir);
    try {
        broker.addConnector(createVmTransportServer(createVmTransportUri(name)));
    } catch (Exception e) {
        throw new IllegalStateException("Could not create VM Transport URI", e);
    }
    broker.setUseJmx(false);

    return broker;
}
 
开发者ID:zapodot,项目名称:embedded-jms-junit,代码行数:17,代码来源:EmbeddedJmsRuleImpl.java

示例11: startMessagingSystem

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void startMessagingSystem()
{
    try
    {
        brokerService = new BrokerService();
        brokerService.addConnector(url+this.getApplicationPort2());
        brokerService.setPersistent(false);
        brokerService.setUseJmx(false);
        brokerService.setBrokerName("MithraTest"+this.getApplicationPort2());
        brokerService.setShutdownOnMasterFailure(false);
        brokerService.start();
    }
    catch(Exception e)
    {
       getLogger().error("Unable to start messaging broker");
       throw new RuntimeException("Exception during messaging broker startup", e);
    }
}
 
开发者ID:goldmansachs,项目名称:reladomo,代码行数:19,代码来源:MultiVmNotificationsTestSuite.java

示例12: startService

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void startService() {
  if (startedFlag.get()) {
    return;
  }

  synchronized (INSTANCE) {
    if (startedFlag.get()) {
      return;
    }

    try {
      Configuration configuration = ConfigurationReader.INSTANCE
          .readConfiguration("channel-site.xml");
      String port = configuration.get("events.channel.default.port", "61616");
      broker = new BrokerService();
      broker.addConnector("tcp://localhost:" + port);
      broker.start();
      startedFlag.set(true);
    } catch (Exception e) {
      throw new IllegalStateException("Event MQ Channel Initialization Failure", e);
    }
  }
}
 
开发者ID:DataRPM-Labs,项目名称:sigma-events,代码行数:24,代码来源:EmbeddedActiveMQService.java

示例13: startBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
  LOG.info("Finding free network port");
  try (ServerSocket socket = new ServerSocket(0)) {
    port = socket.getLocalPort();
  }

  LOG.info("Starting ActiveMQ brokerService on {}", port);
  brokerService = new BrokerService();
  brokerService.setDeleteAllMessagesOnStartup(true);
  // use memory persistence for the test: it's faster and don't pollute test folder with KahaDB
  brokerService.setPersistent(false);
  brokerService.addConnector("mqtt://localhost:" + port);
  brokerService.start();
  brokerService.waitUntilStarted();
}
 
开发者ID:apache,项目名称:beam,代码行数:17,代码来源:MqttIOTest.java

示例14: run

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void run() {
    try {  
        BrokerService broker = new BrokerService();
        synchronized (this) {                                     
            broker.setPersistenceAdapter(new MemoryPersistenceAdapter());                    
            broker.setTmpDataDirectory(new File("./target"));
            broker.addConnector(brokerUrl);
            broker.start();
            Thread.sleep(200);
            notifyAll();
        }
        synchronized (this) {
            while (!shutdownBroker) {
                wait(1000);
            }
        }                
        broker.stop();              
        broker = null;                
    } catch (Exception e) {
        exception = e;
        e.printStackTrace();
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:JmsBroker.java

示例15: run

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void run() {
    try {  
        BrokerService broker = new BrokerService();
        synchronized (this) {                                     
            broker.setPersistenceAdapter(new MemoryPersistenceAdapter());                    
            broker.setTmpDataDirectory(new File("./target"));
            broker.addConnector(brokerUrl);
            broker.start();
            Thread.sleep(200);
            notifyAll();
        }
        synchronized (this) {
            while (!shutdownBroker) {
                wait(1000);
            }
        }                
        broker.stop();              
    } catch (Exception e) {
        exception = e;
        e.printStackTrace();
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:JmsBroker.java


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