org.apache.activemq.broker.BrokerPlugin

Here are the examples of the java api class org.apache.activemq.broker.BrokerPlugin taken from open source projects.

1. AMQ4889Test#createBroker()

Project: activemq-artemis
Source File: AMQ4889Test.java
View license
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;
}

2. AuthorizationFromAdminViewTest#createBroker()

View license
private void createBroker() throws Exception {
    broker = BrokerFactory.createBroker("broker:(vm://localhost)");
    broker.setPersistent(false);
    broker.setBrokerName(getName());
    AuthorizationPlugin plugin = new AuthorizationPlugin();
    plugin.setMap(new SimpleAuthorizationMap());
    BrokerPlugin[] plugins = new BrokerPlugin[] { plugin };
    broker.setPlugins(plugins);
    broker.start();
}

3. QpidJmsTestSupport#createBroker()

Project: qpid-jms
Source File: QpidJmsTestSupport.java
View license
protected BrokerService createBroker(String name, boolean deleteAllMessages, Map<String, Integer> portMap) throws Exception {
    BrokerService brokerService = new BrokerService();
    brokerService.setBrokerName(name);
    brokerService.setPersistent(isPersistent());
    brokerService.setSchedulerSupport(isSchedulerSupport());
    brokerService.setAdvisorySupport(isAdvisorySupport());
    brokerService.setDeleteAllMessagesOnStartup(deleteAllMessages);
    brokerService.setUseJmx(true);
    brokerService.getManagementContext().setCreateConnector(false);
    brokerService.setDataDirectory("target/" + name);
    if (isPersistent()) {
        KahaDBStore kaha = new KahaDBStore();
        kaha.setDirectory(new File(KAHADB_DIRECTORY + "/" + name));
        kaha.setConcurrentStoreAndDispatchQueues(isConcurrentStoreAndDispatchQueues());
        kaha.setConcurrentStoreAndDispatchTopics(isConcurrentStoreAndDispatchTopics());
        kaha.setCheckpointInterval(TimeUnit.MINUTES.toMillis(5));
        brokerService.setPersistenceAdapter(kaha);
    }
    configureBrokerPolicies(brokerService);
    ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>();
    BrokerPlugin authenticationPlugin = configureAuthentication();
    if (authenticationPlugin != null) {
        plugins.add(authenticationPlugin);
    }
    BrokerPlugin authorizationPlugin = configureAuthorization();
    if (authorizationPlugin != null) {
        plugins.add(authorizationPlugin);
    }
    addAdditionalBrokerPlugins(plugins);
    if (!plugins.isEmpty()) {
        BrokerPlugin[] array = new BrokerPlugin[plugins.size()];
        brokerService.setPlugins(plugins.toArray(array));
    }
    addAdditionalConnectors(brokerService, portMap);
    return brokerService;
}

4. BrokerStatisticsPluginTest#createBroker()

View license
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;
}