org.apache.activemq.ActiveMQConnectionFactory.setTrustedPackages()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.apache.activemq.ActiveMQConnectionFactory.setTrustedPackages()方法的一些代码示例,展示了ActiveMQConnectionFactory.setTrustedPackages()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActiveMQConnectionFactory.setTrustedPackages()方法的具体详情如下:
包路径:org.apache.activemq.ActiveMQConnectionFactory
类名称:ActiveMQConnectionFactory
方法名:setTrustedPackages

ActiveMQConnectionFactory.setTrustedPackages介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

@Bean
public ActiveMQConnectionFactory activeMQConnectionFactory() {
  ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("your broker URL");
  factory.setTrustedPackages(Arrays.asList("com.my.package"));
  return factory;
}

代码示例来源:origin: mbknor/dropwizard-activemq-bundle

public void init(ActiveMQConfig activeMQConfig, Environment environment) {
  this.environment = environment;
  final String brokerUrl = activeMQConfig.brokerUrl;
  final int configuredTTL = activeMQConfig.timeToLiveInSeconds;
  final Optional<String> username = Optional.ofNullable(activeMQConfig.brokerUsername);
  final Optional<String> password = Optional.ofNullable(activeMQConfig.brokerPassword);
  defaultTimeToLiveInSeconds = Optional.ofNullable(configuredTTL > 0 ? configuredTTL : null);
  log.info("Setting up activeMq with brokerUrl {}", brokerUrl);
  log.debug("All activeMQ config: " + activeMQConfig);
  realConnectionFactory = new ActiveMQConnectionFactory(brokerUrl);
  realConnectionFactory.setTrustedPackages(activeMQConfig.trustedPackages);
  if (username.isPresent() && password.isPresent()) {
    realConnectionFactory.setUserName(username.get());
    realConnectionFactory.setPassword(password.get());
  }
  connectionFactory = new PooledConnectionFactory();
  connectionFactory.setConnectionFactory(realConnectionFactory);
  configurePool(activeMQConfig.pool);
  objectMapper = environment.getObjectMapper();
  environment.lifecycle().manage(this);
  // Must use realConnectionFactory instead of (pooled) connectionFactory for the healthCheck
  // Is needs its own connection since it is both sending and receiving.
  // If using pool, then it might block since no one is available..
  environment.healthChecks().register(healthCheckName,
    new ActiveMQHealthCheck(realConnectionFactory, activeMQConfig.healthCheckMillisecondsToWait)
  );
  this.shutdownWaitInSeconds = activeMQConfig.shutdownWaitInSeconds;
}

代码示例来源:origin: org.apache.uima/uima-ducc-common

PooledConnectionFactory amqf = (PooledConnectionFactory)duccAMQComponent.getConfiguration().getConnectionFactory();
ActiveMQConnectionFactory f = (ActiveMQConnectionFactory)amqf.getConnectionFactory();
f.setTrustedPackages(Arrays.asList(pkgs));

相关文章

微信公众号

最新文章

更多

ActiveMQConnectionFactory类方法