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


Java BrokerPlugin类代码示例

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


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

示例1: startBroker

import org.apache.activemq.broker.BrokerPlugin; //导入依赖的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.BrokerPlugin; //导入依赖的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();
}
 
开发者ID:dcsolutions,项目名称:kalinka,代码行数:24,代码来源:KalinkaClusterPluginTest.java

示例3: createBroker

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

示例4: createBroker

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

示例5: startBroker

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

示例6: configureAuthentication

import org.apache.activemq.broker.BrokerPlugin; //导入依赖的package包/类
protected BrokerPlugin configureAuthentication() throws Exception {
    List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
    users.add(new AuthenticationUser("system", "manager", "users,admins"));
    users.add(new AuthenticationUser("user", "password", "users"));
    users.add(new AuthenticationUser("guest", "password", "guests"));
    SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);

    return authenticationPlugin;
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:PooledConnectionSecurityExceptionTest.java

示例7: startWithPlugins

import org.apache.activemq.broker.BrokerPlugin; //导入依赖的package包/类
/**
 * Starting ActiveMQ embedded broker after specifying plugins.
 *
 * @param brokerPlugins the array of BrokerPlugins to be set
 * @return whether or not the broker was stated successfully
 */
public boolean startWithPlugins(BrokerPlugin[] brokerPlugins) {
    try {
        setInitialConfigurations();
        broker.setPlugins(brokerPlugins);
        startBroker();
        return true;
    } catch (Exception e) {
        log.error("JMSServerController: There was an error starting JMS broker: " + serverName, e);
        return false;
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:18,代码来源:JMSBroker.java

示例8: startBroker

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

示例9: configureAuthentication

import org.apache.activemq.broker.BrokerPlugin; //导入依赖的package包/类
protected BrokerPlugin configureAuthentication() throws Exception {
  List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
  users.add(new AuthenticationUser(USERNAME_ADMIN, PASSWORD_ADMIN, "users,admins"));
  users.add(new AuthenticationUser(USERNAME_USER, PASSWORD_USER, "users"));
  users.add(new AuthenticationUser(USERNAME_GUEST, PASSWORD_GUEST, "guests"));
  SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);
  authenticationPlugin.setAnonymousAccessAllowed(isAnonymousAccessAllowed());

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

示例10: JMSBrokerService

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

示例11: setUp

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

示例12: setUp

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

示例13: createBroker

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

示例14: createBroker

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

示例15: configureAuthentication

import org.apache.activemq.broker.BrokerPlugin; //导入依赖的package包/类
protected BrokerPlugin configureAuthentication() throws Exception {
   List<AuthenticationUser> users = new ArrayList<>();
   users.add(new AuthenticationUser(USER, GOOD_USER_PASSWORD, "users"));
   SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);

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


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