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


Java BrokerService.setPlugins方法代码示例

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


在下文中一共展示了BrokerService.setPlugins方法的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: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected BrokerService createBroker(String name, boolean deleteMessagesOnStartup,
                                     Map<String, Integer> portMap) throws Exception {
  BrokerService brokerService = new BrokerService();
  brokerService.setBrokerName(name);
  brokerService.setDeleteAllMessagesOnStartup(deleteMessagesOnStartup);
  brokerService.setUseJmx(true);
  brokerService.getManagementContext().setCreateConnector(false);
  brokerService.setDataDirectory(DATA_PARENT_DIR + File.separator + "data" + File.separator + name);
  brokerService.setPersistent(false);
  brokerService.setSchedulerSupport(false);
  brokerService.setAdvisorySupport(false);

  ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>();
  BrokerPlugin authenticationPlugin = configureAuthentication();
  if (authenticationPlugin != null) {
    plugins.add(authenticationPlugin);
  }

  if (!plugins.isEmpty()) {
    brokerService.setPlugins(plugins.toArray(new BrokerPlugin[0]));
  }

  addAdditionalConnectors(brokerService, portMap);

  return brokerService;
}
 
开发者ID:vert-x3,项目名称:vertx-amqp-bridge,代码行数:27,代码来源:ActiveMQTestBase.java

示例3: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected BrokerService createBroker() throws Exception {
   brokerService = new BrokerService();
   brokerService.setPersistent(false);

   ArrayList<BrokerPlugin> plugins = new ArrayList<>();
   BrokerPlugin authenticationPlugin = configureAuthentication();
   plugins.add(authenticationPlugin);
   BrokerPlugin[] array = new BrokerPlugin[plugins.size()];
   brokerService.setPlugins(plugins.toArray(array));

   transportConnector = brokerService.addConnector(LOCAL_URI);
   proxyConnector = new ProxyConnector();
   proxyConnector.setName("proxy");
   proxyConnector.setBind(new URI(PROXY_URI));
   proxyConnector.setRemote(new URI(LOCAL_URI));
   brokerService.addProxyConnector(proxyConnector);

   brokerService.start();
   brokerService.waitUntilStarted();

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

示例4: startBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void startBroker() throws Exception {
    brokerService = new BrokerService();
    brokerService.setPersistent(false);
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setAdvisorySupport(false);
    brokerService.getManagementContext().setCreateConnector(false);
    brokerService.getManagementContext().setCreateMBeanServer(false);
    brokerService.addConnector("tcp://0.0.0.0:0");

    ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>();

    BrokerPlugin authenticationPlugin = configureAuthentication();
    if (authenticationPlugin != null) {
        plugins.add(configureAuthorization());
    }

    BrokerPlugin authorizationPlugin = configureAuthorization();
    if (authorizationPlugin != null) {
        plugins.add(configureAuthentication());
    }

    if (!plugins.isEmpty()) {
        BrokerPlugin[] array = new BrokerPlugin[plugins.size()];
        brokerService.setPlugins(plugins.toArray(array));
    }

    brokerService.start();
    brokerService.waitUntilStarted();

    connectionURI = brokerService.getTransportConnectors().get(0).getPublishableConnectString();
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:32,代码来源:PooledConnectionSecurityExceptionTest.java

示例5: startBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void startBroker() throws Exception {
    String brokerName = "test-broker-" + System.currentTimeMillis();
    String brokerUri = "vm://" + brokerName;
    broker = new BrokerService();
    broker.setBrokerName(brokerName);
    broker.setBrokerId(brokerName);
    broker.addConnector(brokerUri);
    broker.setPersistent(false);
    // This Broker Plugin simulates Producer Flow Control by delaying the broker's ACK by 2 seconds
    broker.setPlugins(new BrokerPlugin[] {new DelayerBrokerPlugin()});
    broker.start();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:JmsBlockedAsyncRoutingEngineTest.java

示例6: JMSBrokerService

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public JMSBrokerService(String url) throws Exception {
    System.setProperty(JMSTestConstants.ACTIVEMQ_LOGIN_CONFIG,
            getClass().getClassLoader().getResource(JMSTestConstants.ACTIVEMQ_LOGIN_CONFIG_DIR).getPath());
    broker = new BrokerService();
    broker.setDataDirectory(JMSTestConstants.TEST_LOG_DIR);
    broker.setBrokerName(BROKER_NAME);
    broker.addConnector(url);
    broker.setPlugins(new BrokerPlugin[] { new JaasAuthenticationPlugin() });
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:10,代码来源:JMSBrokerService.java

示例7: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  baseDir = Files.createTempDir();
  tmpDir = new File(baseDir, "tmp");
  dataDir = new File(baseDir, "data");
  Assert.assertTrue(tmpDir.mkdir());
  passwordFile = new File(baseDir, "password");
  Files.write(PASSWORD.getBytes(StandardCharsets.UTF_8), passwordFile);

  broker = new BrokerService();

  broker.addConnector(BROKER_BIND_URL);
  broker.setTmpDataDirectory(tmpDir);
  broker.setDataDirectoryFile(dataDir);
  List<AuthenticationUser> users = Lists.newArrayList();
  users.add(new AuthenticationUser(USERNAME, PASSWORD, ""));
  SimpleAuthenticationPlugin authentication = new SimpleAuthenticationPlugin(users);
  broker.setPlugins(new BrokerPlugin[]{authentication});
  broker.start();

  basicConfig = new BasicConfig();
  credentialsConfig = new CredentialsConfig();
  dataFormatConfig = new DataParserFormatConfig();
  messageConfig = new MessageConfig();
  jmsSourceConfig = new JmsSourceConfig();
  credentialsConfig.useCredentials = true;
  credentialsConfig.username = () -> USERNAME;
  credentialsConfig.password = () -> PASSWORD;
  dataFormat = DataFormat.JSON;
  dataFormatConfig.removeCtrlChars = true;
  jmsSourceConfig.initialContextFactory = INITIAL_CONTEXT_FACTORY;
  jmsSourceConfig.connectionFactory = CONNECTION_FACTORY;
  jmsSourceConfig.destinationName = JNDI_PREFIX + DESTINATION_NAME;
  jmsSourceConfig.providerURL = BROKER_BIND_URL;
  // Create a connection and start
  ConnectionFactory factory = new ActiveMQConnectionFactory(USERNAME,
      PASSWORD, BROKER_BIND_URL);
  connection = factory.createConnection();
  connection.start();
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:41,代码来源:TestJmsSource.java

示例8: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  baseDir = Files.createTempDir();
  tmpDir = new File(baseDir, "tmp");
  dataDir = new File(baseDir, "data");
  Assert.assertTrue(tmpDir.mkdir());
  passwordFile = new File(baseDir, "password");
  Files.write(PASSWORD.getBytes(StandardCharsets.UTF_8), passwordFile);

  broker = new BrokerService();

  broker.addConnector(BROKER_BIND_URL);
  broker.setTmpDataDirectory(tmpDir);
  broker.setDataDirectoryFile(dataDir);
  List<AuthenticationUser> users = Lists.newArrayList();
  users.add(new AuthenticationUser(USERNAME, PASSWORD, ""));
  SimpleAuthenticationPlugin authentication = new SimpleAuthenticationPlugin(users);
  broker.setPlugins(new BrokerPlugin[]{authentication});
  broker.start();

  credentialsConfig = new CredentialsConfig();
  dataFormatConfig = new DataGeneratorFormatConfig();
  jmsTargetConfig = new JmsTargetConfig();
  credentialsConfig.useCredentials = true;
  credentialsConfig.username = () -> USERNAME;
  credentialsConfig.password = () -> PASSWORD;
  jmsTargetConfig.destinationName = JNDI_PREFIX + DESTINATION_NAME;
  jmsTargetConfig.initialContextFactory = INITIAL_CONTEXT_FACTORY;
  jmsTargetConfig.connectionFactory = CONNECTION_FACTORY;
  jmsTargetConfig.providerURL = BROKER_BIND_URL;
  // Create a connection and start
  ConnectionFactory factory = new ActiveMQConnectionFactory(USERNAME,
      PASSWORD, BROKER_BIND_URL);
  connection = factory.createConnection();
  connection.start();
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:37,代码来源:TestJmsTarget.java

示例9: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
   BrokerService broker = super.createBroker();
   broker.setPopulateJMSXUserID(true);
   broker.setUseAuthenticatedPrincipalForJMSXUserID(true);
   broker.setPlugins(new BrokerPlugin[]{authorizationPlugin, authenticationPlugin});
   broker.setPersistent(false);
   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:10,代码来源:SimpleSecurityBrokerSystemTest.java

示例10: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected BrokerService createBroker() throws Exception {
   BrokerService answer = new BrokerService();
   BrokerPlugin[] plugins = new BrokerPlugin[1];
   plugins[0] = new StatisticsBrokerPlugin();
   answer.setPlugins(plugins);
   answer.setDeleteAllMessagesOnStartup(true);
   answer.addConnector("tcp://localhost:0");
   answer.start();
   return answer;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:11,代码来源:BrokerStatisticsPluginTest.java

示例11: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
   BrokerService broker = super.createBroker();
   AuthorizationPlugin authorizationPlugin = new AuthorizationPlugin(createAuthorizationMap());

   broker.setPlugins(new BrokerPlugin[]{authorizationPlugin, new SimpleSecurityBrokerSystemTest.SimpleAuthenticationFactory()});
   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:SecureDLQTest.java

示例12: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected BrokerService createBroker() {
   BrokerService broker = new BrokerService();
   broker.setPersistent(false);
   broker.setUseJmx(true);
   broker.setPlugins(new BrokerPlugin[]{new DestinationsPlugin()});
   broker.setDataDirectory("target/test");
   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:DestinationsPluginTest.java

示例13: startBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
   brokerService = new BrokerService();
   brokerService.setAdvisorySupport(false);
   brokerService.setUseJmx(false);
   brokerService.setPersistent(false);
   brokerService.setPlugins(new BrokerPlugin[]{new SimpleAuthenticationPlugin(new ArrayList())});
   brokerUri = brokerService.addConnector("tcp://0.0.0.0:0").getConnectUri();
   brokerService.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:11,代码来源:ExceptionListenerTest.java

示例14: setup

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setup() throws Exception {
  baseDir = Files.createTempDir();
  tmpDir = new File(baseDir, "tmp");
  dataDir = new File(baseDir, "data");
  Assert.assertTrue(tmpDir.mkdir());
  passwordFile = new File(baseDir, "password");
  Files.write(PASSWORD.getBytes(Charsets.UTF_8), passwordFile);

  broker = new BrokerService();

  broker.addConnector(BROKER_BIND_URL);
  broker.setTmpDataDirectory(tmpDir);
  broker.setDataDirectoryFile(dataDir);
  List<AuthenticationUser> users = Lists.newArrayList();
  users.add(new AuthenticationUser(USERNAME, PASSWORD, ""));
  SimpleAuthenticationPlugin authentication = new SimpleAuthenticationPlugin(users);
  broker.setPlugins(new BrokerPlugin[]{authentication});
  broker.start();

  context = new Context();
  context.put(JMSSourceConfiguration.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
  context.put(JMSSourceConfiguration.PROVIDER_URL, BROKER_BIND_URL);
  context.put(JMSSourceConfiguration.DESTINATION_NAME, DESTINATION_NAME);
  context.put(JMSSourceConfiguration.USERNAME, USERNAME);
  context.put(JMSSourceConfiguration.PASSWORD_FILE, passwordFile.getAbsolutePath());

  events = Lists.newArrayList();
  source = new JMSSource();
  source.setName("JMSSource-" + UUID.randomUUID());
  ChannelProcessor channelProcessor = mock(ChannelProcessor.class);
  doAnswer(new Answer<Void>() {
    @Override
    public Void answer(InvocationOnMock invocation) throws Throwable {
      events.addAll((List<Event>)invocation.getArguments()[0]);
      return null;
    }
  }).when(channelProcessor).processEventBatch(any(List.class));
  source.setChannelProcessor(channelProcessor);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:42,代码来源:TestIntegrationActiveMQ.java

示例15: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
   TraceBrokerPathPlugin tbppA = new TraceBrokerPathPlugin();
   tbppA.setStampProperty(traceProperty);

   TraceBrokerPathPlugin tbppB = new TraceBrokerPathPlugin();
   tbppB.setStampProperty(traceProperty);

   brokerA = new BrokerService();
   brokerA.setBrokerName("brokerA");
   brokerA.setPersistent(false);
   brokerA.setUseJmx(true);
   brokerA.setPlugins(new BrokerPlugin[]{tbppA});
   tcpConnectorA = brokerA.addConnector("tcp://localhost:0");

   brokerB = new BrokerService();
   brokerB.setBrokerName("brokerB");
   brokerB.setPersistent(false);
   brokerB.setUseJmx(true);
   brokerB.setPlugins(new BrokerPlugin[]{tbppB});
   tcpConnectorB = brokerB.addConnector("tcp://localhost:0");

   brokerA.addNetworkConnector("static:(" + tcpConnectorB.getConnectUri().toString() + ")");

   brokerB.start();
   brokerB.waitUntilStarted();
   brokerA.start();
   brokerA.waitUntilStarted();

   // Initialise connection to A and MessageProducer
   connectionA = new ActiveMQConnectionFactory(tcpConnectorA.getConnectUri()).createConnection();
   connectionA.start();
   sessionA = connectionA.createSession(false, Session.AUTO_ACKNOWLEDGE);
   producer = sessionA.createProducer(sessionA.createQueue(queue));
   producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

   // Initialise connection to B and MessageConsumer
   connectionB = new ActiveMQConnectionFactory(tcpConnectorB.getConnectUri()).createConnection();
   connectionB.start();
   sessionB = connectionB.createSession(false, Session.AUTO_ACKNOWLEDGE);
   consumer = sessionB.createConsumer(sessionB.createQueue(queue));

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:45,代码来源:TraceBrokerPathPluginTest.java


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