當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。