• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JmsListenerEndpointRegistrar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Override
public void configureJmsListeners (JmsListenerEndpointRegistrar aRegistrar) {
  CoordinatorProperties coordinatorProperties = properties.getCoordinator();
  WorkerProperties workerProperties = properties.getWorker();
  if(coordinatorProperties.isEnabled()) {
    registerListenerEndpoint(aRegistrar, Queues.COMPLETIONS, coordinatorProperties.getSubscriptions().getCompletions() , coordinator, "complete");
    registerListenerEndpoint(aRegistrar, Queues.ERRORS, coordinatorProperties.getSubscriptions().getErrors(), coordinator, "handleError");
    registerListenerEndpoint(aRegistrar, Queues.EVENTS, coordinatorProperties.getSubscriptions().getEvents(), eventListener, "onApplicationEvent");
    registerListenerEndpoint(aRegistrar, Queues.JOBS, coordinatorProperties.getSubscriptions().getJobs(), coordinator, "start");
  }
  if(workerProperties.isEnabled()) {
    Map<String, Object> subscriptions = workerProperties.getSubscriptions();
    subscriptions.forEach((k,v) -> registerListenerEndpoint(aRegistrar, k, Integer.valueOf((String)v), worker, "handle"));
    registerListenerEndpoint(aRegistrar, Exchanges.CONTROL+"/"+Exchanges.CONTROL, 1, worker, "handle");
  }
}
 
开发者ID:creactiviti,项目名称:piper,代码行数:17,代码来源:JmsMessengerConfiguration.java


示例2: registerListenerEndpoint

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
private void registerListenerEndpoint(JmsListenerEndpointRegistrar aRegistrar, String aQueueName, int aConcurrency, Object aDelegate, String aMethodName) {
  logger.info("Registring JMS Listener: {} -> {}:{}", aQueueName, aDelegate.getClass().getName(), aMethodName);
  
  MessageListenerAdapter messageListener = new MessageListenerAdapter(aDelegate);
  messageListener.setMessageConverter(jacksonJmsMessageConverter(objectMapper));
  messageListener.setDefaultListenerMethod(aMethodName);

  SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
  endpoint.setId(aQueueName+"Endpoint");
  endpoint.setDestination(aQueueName);
  endpoint.setMessageListener(messageListener);

  aRegistrar.registerEndpoint(endpoint,createContainerFactory(aConcurrency));
}
 
开发者ID:creactiviti,项目名称:piper,代码行数:15,代码来源:JmsMessengerConfiguration.java


示例3: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setEndpointRegistry(customRegistry());

	// Also register a custom endpoint
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(simpleMessageListener());
	registrar.registerEndpoint(endpoint);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:EnableJmsTests.java


示例4: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(messageListener);
	registrar.registerEndpoint(endpoint);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:AnnotationDrivenNamespaceTests.java


示例5: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
    SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
    endpoint.setId("myJmsEndpoint");
    endpoint.setDestination(environment.getProperty("queue", "test.queue"));
    endpoint.setMessageListener(message -> {
        try {
            System.out.print(((TextMessage)message).getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    });
    registrar.registerEndpoint(endpoint);
}
 
开发者ID:aquaplanet,项目名称:activemq-demo,代码行数:15,代码来源:ConsumerApplication.java


示例6: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
  registrar.setContainerFactory(containerFactory);
  SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
  endpoint.setDestination("core-" + this.type + "-actions");
  endpoint.setMessageListener(this);
  loadProperties();
  log.debug("CONFIGURE Properties are: " + properties);
  endpoint.setConcurrency("5-" + properties.getProperty("concurrency", "15"));
  endpoint.setId(String.valueOf(Thread.currentThread().getId()));
  registrar.registerEndpoint(endpoint);
}
 
开发者ID:openbaton,项目名称:openbaton-libs,代码行数:13,代码来源:AbstractVnfmSpringJMS.java


示例7: resetRegistrar

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
/**
 * resets the registrar; this method is a hack and could break upon upgrades to Spring since it uses reflection
 * to access private members. TODO: come up with better approach
 */
private void resetRegistrar() {
    Field registrarField = ReflectionUtils.findField(JmsListenerAnnotationBeanPostProcessor.class, "registrar");
    ReflectionUtils.makeAccessible(registrarField);
    JmsListenerEndpointRegistrar registrar = (JmsListenerEndpointRegistrar) ReflectionUtils.getField(registrarField, this);
    Field descriptorField = ReflectionUtils.findField(JmsListenerEndpointRegistrar.class, "endpointDescriptors");
    ReflectionUtils.makeAccessible(descriptorField);
    List descriptorList = (List) ReflectionUtils.getField(descriptorField, registrar);
    descriptorList.clear();
}
 
开发者ID:cfagiani,项目名称:datasponge,代码行数:14,代码来源:DynamicJmsListenerAnnotationBeanPostProcessor.java


示例8: setRegistrar

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
void setRegistrar(JmsListenerEndpointRegistrar registrar) {
  this.registrar = registrar;
}
 
开发者ID:opentracing-contrib,项目名称:java-jms,代码行数:4,代码来源:TracingJmsListenerEndpointRegistry.java


示例9: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
  registry.setRegistrar(registrar);
  registrar.setEndpointRegistry(registry);
}
 
开发者ID:opentracing-contrib,项目名称:java-jms,代码行数:6,代码来源:TracingJmsListenerConfigurer.java


示例10: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
    registrar.setEndpointRegistry(endpointRegistry);
    registrar.setMessageHandlerMethodFactory(messageHandlerMethodFactory);
}
 
开发者ID:kinglcc,项目名称:spring-boot-jms,代码行数:6,代码来源:MethodJmsListenerConfigurer.java


示例11: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
  initializeFactory(methodFactory);

  /*
   As a single container factory setup can be fairly common, the containerFactory attribute can 
   be omitted if a default one has either been set or discovered. 
   By default, we look up for a bean named jmsListenerContainerFactory.
   */
  if (configuration == null) {
    logger.warn("Configuration file ('configuration.properties') is missing.");
    return;
  }

  // Check if any endpoint has been defined
  String endpointsStr = StringUtils.trim(configuration.getProperty(CONFIGURATION_KEY_JMS_ENDPOINTS));
  if (StringUtils.isEmpty(endpointsStr)) {
    logger.warn("No endpoint has been defined.");
    return;
  }

  // Parse endpoints ids
  String[] endpoints = stringAsArray(endpointsStr);
  
  String defaultLogin = configuration.getProperty(CONFIGURATION_KEY_JMS_LOGIN);
  String defaultPassword = configuration.getProperty(CONFIGURATION_KEY_JMS_PASSWORD);

  // Configure each endpoint
  for (String endpointId : endpoints) {
    JmsListenerEndpoint endpoint;
    try {
      endpoint = configureEndpoint(endpointId, defaultLogin, defaultPassword);
    } catch (Exception ex) {
      StringBuilder errorMessage = new StringBuilder();
      errorMessage.append("Failed to configure endpoint '").append(endpointId).append("'.");
      if (ignoreErroneousEndpoint) {
        errorMessage.append(" Go to the next one.");
        logger.warn(errorMessage.toString(), ex);
        continue;
      }
      else {
        throw new JMSModuleException(errorMessage.toString(), ex);
      }
    }
    // The default registrar is already populated with the container factory
    //  bean named "jmsListenerContainerFactory" by default
    //registrar.setContainerFactoryBeanName();
    registrar.registerEndpoint(endpoint);
  }
}
 
开发者ID:benjamin-cartereau,项目名称:w4-bpmnplus-module-jms,代码行数:51,代码来源:ApplicationConfig.java


示例12: testConfigureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
@Test
public void testConfigureJmsListeners() {
  JmsListenerEndpointRegistrar registrar = mock(JmsListenerEndpointRegistrar.class);
  instance.setIgnoreErroneousEndpoint(false);
  instance.configureJmsListeners(registrar);
}
 
开发者ID:benjamin-cartereau,项目名称:w4-bpmnplus-module-jms,代码行数:7,代码来源:ApplicationConfigTest.java


示例13: configureJmsListeners

import org.springframework.jms.config.JmsListenerEndpointRegistrar; //导入依赖的package包/类
/**
 * Callback allowing a {@link org.springframework.jms.config.JmsListenerEndpointRegistry
 * JmsListenerEndpointRegistry} and specific {@link org.springframework.jms.config.JmsListenerEndpoint
 * JmsListenerEndpoint} instances to be registered against the given
 * {@link JmsListenerEndpointRegistrar}. The default
 * {@link org.springframework.jms.config.JmsListenerContainerFactory JmsListenerContainerFactory}
 * can also be customized.
 * @param registrar the registrar to be configured
 */
void configureJmsListeners(JmsListenerEndpointRegistrar registrar);
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:JmsListenerConfigurer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ICONST类代码示例发布时间:2022-05-23
下一篇:
Java NoLoggingImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap