org.springframework.jms.config.JmsListenerConfigUtils Java Examples

The following examples show how to use org.springframework.jms.config.JmsListenerConfigUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JmsListenerAnnotationBeanPostProcessor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void afterSingletonsInstantiated() {
	// Remove resolved singleton classes from cache
	this.nonAnnotatedClasses.clear();

	if (this.beanFactory instanceof ListableBeanFactory) {
		// Apply JmsListenerConfigurer beans from the BeanFactory, if any
		Map<String, JmsListenerConfigurer> beans =
				((ListableBeanFactory) this.beanFactory).getBeansOfType(JmsListenerConfigurer.class);
		List<JmsListenerConfigurer> configurers = new ArrayList<>(beans.values());
		AnnotationAwareOrderComparator.sort(configurers);
		for (JmsListenerConfigurer configurer : configurers) {
			configurer.configureJmsListeners(this.registrar);
		}
	}

	if (this.containerFactoryBeanName != null) {
		this.registrar.setContainerFactoryBeanName(this.containerFactoryBeanName);
	}

	if (this.registrar.getEndpointRegistry() == null) {
		// Determine JmsListenerEndpointRegistry bean from the BeanFactory
		if (this.endpointRegistry == null) {
			Assert.state(this.beanFactory != null, "BeanFactory must be set to find endpoint registry by bean name");
			this.endpointRegistry = this.beanFactory.getBean(
					JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME, JmsListenerEndpointRegistry.class);
		}
		this.registrar.setEndpointRegistry(this.endpointRegistry);
	}


	// Set the custom handler method factory once resolved by the configurer
	MessageHandlerMethodFactory handlerMethodFactory = this.registrar.getMessageHandlerMethodFactory();
	if (handlerMethodFactory != null) {
		this.messageHandlerMethodFactory.setMessageHandlerMethodFactory(handlerMethodFactory);
	}

	// Actually register all listeners
	this.registrar.afterPropertiesSet();
}
 
Example #2
Source File: JmsListenerAnnotationBeanPostProcessor.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void afterSingletonsInstantiated() {
	// Remove resolved singleton classes from cache
	this.nonAnnotatedClasses.clear();

	if (this.beanFactory instanceof ListableBeanFactory) {
		// Apply JmsListenerConfigurer beans from the BeanFactory, if any
		Map<String, JmsListenerConfigurer> beans =
				((ListableBeanFactory) this.beanFactory).getBeansOfType(JmsListenerConfigurer.class);
		List<JmsListenerConfigurer> configurers = new ArrayList<>(beans.values());
		AnnotationAwareOrderComparator.sort(configurers);
		for (JmsListenerConfigurer configurer : configurers) {
			configurer.configureJmsListeners(this.registrar);
		}
	}

	if (this.containerFactoryBeanName != null) {
		this.registrar.setContainerFactoryBeanName(this.containerFactoryBeanName);
	}

	if (this.registrar.getEndpointRegistry() == null) {
		// Determine JmsListenerEndpointRegistry bean from the BeanFactory
		if (this.endpointRegistry == null) {
			Assert.state(this.beanFactory != null, "BeanFactory must be set to find endpoint registry by bean name");
			this.endpointRegistry = this.beanFactory.getBean(
					JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME, JmsListenerEndpointRegistry.class);
		}
		this.registrar.setEndpointRegistry(this.endpointRegistry);
	}


	// Set the custom handler method factory once resolved by the configurer
	MessageHandlerMethodFactory handlerMethodFactory = this.registrar.getMessageHandlerMethodFactory();
	if (handlerMethodFactory != null) {
		this.messageHandlerMethodFactory.setMessageHandlerMethodFactory(handlerMethodFactory);
	}

	// Actually register all listeners
	this.registrar.afterPropertiesSet();
}
 
Example #3
Source File: JmsListenerAnnotationBeanPostProcessor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void afterSingletonsInstantiated() {
	this.registrar.setBeanFactory(this.beanFactory);

	if (this.beanFactory instanceof ListableBeanFactory) {
		Map<String, JmsListenerConfigurer> instances =
				((ListableBeanFactory) this.beanFactory).getBeansOfType(JmsListenerConfigurer.class);
		for (JmsListenerConfigurer configurer : instances.values()) {
			configurer.configureJmsListeners(this.registrar);
		}
	}

	if (this.registrar.getEndpointRegistry() == null) {
		if (this.endpointRegistry == null) {
			Assert.state(this.beanFactory != null, "BeanFactory must be set to find endpoint registry by bean name");
			this.endpointRegistry = this.beanFactory.getBean(
					JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME, JmsListenerEndpointRegistry.class);
		}
		this.registrar.setEndpointRegistry(this.endpointRegistry);
	}

	if (this.containerFactoryBeanName != null) {
		this.registrar.setContainerFactoryBeanName(this.containerFactoryBeanName);
	}

	// Set the custom handler method factory once resolved by the configurer
	MessageHandlerMethodFactory handlerMethodFactory = this.registrar.getMessageHandlerMethodFactory();
	if (handlerMethodFactory != null) {
		this.messageHandlerMethodFactory.setMessageHandlerMethodFactory(handlerMethodFactory);
	}

	// Actually register all listeners
	this.registrar.afterPropertiesSet();
}
 
Example #4
Source File: JmsBootstrapConfiguration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JmsListenerAnnotationBeanPostProcessor jmsListenerAnnotationProcessor() {
	return new JmsListenerAnnotationBeanPostProcessor();
}
 
Example #5
Source File: JmsBootstrapConfiguration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME)
public JmsListenerEndpointRegistry defaultJmsListenerEndpointRegistry() {
	return new JmsListenerEndpointRegistry();
}
 
Example #6
Source File: JmsBootstrapConfiguration.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JmsListenerAnnotationBeanPostProcessor jmsListenerAnnotationProcessor() {
	return new JmsListenerAnnotationBeanPostProcessor();
}
 
Example #7
Source File: JmsBootstrapConfiguration.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME)
public JmsListenerEndpointRegistry defaultJmsListenerEndpointRegistry() {
	return new JmsListenerEndpointRegistry();
}
 
Example #8
Source File: JmsBootstrapConfiguration.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JmsListenerAnnotationBeanPostProcessor jmsListenerAnnotationProcessor() {
	return new JmsListenerAnnotationBeanPostProcessor();
}
 
Example #9
Source File: JmsBootstrapConfiguration.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME)
public JmsListenerEndpointRegistry defaultJmsListenerEndpointRegistry() {
	return new JmsListenerEndpointRegistry();
}