• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JmsListenerEndpointRegistry类的典型用法和代码示例

java 1次浏览

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

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

示例1: testCustomConfiguration

点赞 3

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
/**
 * Test for {@link CustomBean} and an manually endpoint registered
 * with "myCustomEndpointId". The custom endpoint does not provide
 * any factory so it's registered with the default one
 */
public void testCustomConfiguration(ApplicationContext context) {
	JmsListenerContainerTestFactory defaultFactory =
			context.getBean("jmsListenerContainerFactory", JmsListenerContainerTestFactory.class);
	JmsListenerContainerTestFactory customFactory =
			context.getBean("customFactory", JmsListenerContainerTestFactory.class);
	assertEquals(1, defaultFactory.getListenerContainers().size());
	assertEquals(1, customFactory.getListenerContainers().size());
	JmsListenerEndpoint endpoint = defaultFactory.getListenerContainers().get(0).getEndpoint();
	assertEquals("Wrong endpoint type", SimpleJmsListenerEndpoint.class, endpoint.getClass());
	assertEquals("Wrong listener set in custom endpoint", context.getBean("simpleMessageListener"),
			((SimpleJmsListenerEndpoint) endpoint).getMessageListener());

	JmsListenerEndpointRegistry customRegistry =
			context.getBean("customRegistry", JmsListenerEndpointRegistry.class);
	assertEquals("Wrong number of containers in the registry", 2,
			customRegistry.getListenerContainerIds().size());
	assertEquals("Wrong number of containers in the registry", 2,
			customRegistry.getListenerContainers().size());
	assertNotNull("Container with custom id on the annotation should be found",
			customRegistry.getListenerContainer("listenerId"));
	assertNotNull("Container created with custom id should be found",
			customRegistry.getListenerContainer("myCustomEndpointId"));
}
 

开发者ID:langtianya,
项目名称:spring4-understanding,
代码行数:29,
代码来源:AbstractJmsAnnotationDrivenTests.java

示例2: afterSingletonsInstantiated

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@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();
}
 

开发者ID:langtianya,
项目名称:spring4-understanding,
代码行数:35,
代码来源:JmsListenerAnnotationBeanPostProcessor.java

示例3: controlSearchIndexUpdateJmsMessageListener

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
/**
 * Periodically check the configuration and apply the action to the storage policy processor JMS message listener service, if needed.
 */
@Scheduled(fixedDelay = 60000)
public void controlSearchIndexUpdateJmsMessageListener()
{
    try
    {
        // Get the configuration setting.
        Boolean jmsMessageListenerEnabled = Boolean.valueOf(configurationHelper.getProperty(ConfigurationValue.SEARCH_INDEX_UPDATE_JMS_LISTENER_ENABLED));

        // Get the registry bean.
        JmsListenerEndpointRegistry registry = ApplicationContextHolder.getApplicationContext()
            .getBean("org.springframework.jms.config.internalJmsListenerEndpointRegistry", JmsListenerEndpointRegistry.class);

        // Get the search index update JMS message listener container.
        MessageListenerContainer jmsMessageListenerContainer =
            registry.getListenerContainer(HerdJmsDestinationResolver.SQS_DESTINATION_SEARCH_INDEX_UPDATE_QUEUE);

        // Get the current JMS message listener status and the configuration value.
        LOGGER.debug("controlSearchIndexUpdateJmsMessageListener(): {}={} jmsMessageListenerContainer.isRunning()={}",
            ConfigurationValue.SEARCH_INDEX_UPDATE_JMS_LISTENER_ENABLED.getKey(), jmsMessageListenerEnabled, jmsMessageListenerContainer.isRunning());

        // Apply the relative action if needed.
        if (!jmsMessageListenerEnabled && jmsMessageListenerContainer.isRunning())
        {
            LOGGER.info("controlSearchIndexUpdateJmsMessageListener(): Stopping the search index update JMS message listener ...");
            jmsMessageListenerContainer.stop();
            LOGGER.info("controlSearchIndexUpdateJmsMessageListener(): Done");
        }
        else if (jmsMessageListenerEnabled && !jmsMessageListenerContainer.isRunning())
        {
            LOGGER.info("controlSearchIndexUpdateJmsMessageListener(): Starting the search index update JMS message listener ...");
            jmsMessageListenerContainer.start();
            LOGGER.info("controlSearchIndexUpdateJmsMessageListener(): Done");
        }
    }
    catch (Exception e)
    {
        LOGGER.error("controlSearchIndexUpdateJmsMessageListener(): Failed to control the search index update Jms message listener service.", e);
    }
}
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:43,
代码来源:SearchIndexUpdateJmsMessageListener.java

示例4: controlHerdJmsMessageListener

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
/**
 * Periodically check the configuration and apply the action to the herd JMS message listener service, if needed.
 */
@Scheduled(fixedDelay = 60000)
public void controlHerdJmsMessageListener()
{
    try
    {
        // Get the configuration setting.
        Boolean jmsMessageListenerEnabled = Boolean.valueOf(configurationHelper.getProperty(ConfigurationValue.JMS_LISTENER_ENABLED));

        // Get the registry bean.
        JmsListenerEndpointRegistry registry = ApplicationContextHolder.getApplicationContext()
            .getBean("org.springframework.jms.config.internalJmsListenerEndpointRegistry", JmsListenerEndpointRegistry.class);

        // Get the herd JMS message listener container.
        MessageListenerContainer jmsMessageListenerContainer = registry.getListenerContainer(HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING);

        // Get the current JMS message listener status and the configuration value.
        LOGGER.debug("controlHerdJmsMessageListener(): {}={} jmsMessageListenerContainer.isRunning()={}", ConfigurationValue.JMS_LISTENER_ENABLED.getKey(),
            jmsMessageListenerEnabled, jmsMessageListenerContainer.isRunning());

        // Apply the relative action if needed.
        if (!jmsMessageListenerEnabled && jmsMessageListenerContainer.isRunning())
        {
            LOGGER.info("controlHerdJmsMessageListener(): Stopping the herd JMS message listener ...");
            jmsMessageListenerContainer.stop();
            LOGGER.info("controlHerdJmsMessageListener(): Done");
        }
        else if (jmsMessageListenerEnabled && !jmsMessageListenerContainer.isRunning())
        {
            LOGGER.info("controlHerdJmsMessageListener(): Starting the herd JMS message listener ...");
            jmsMessageListenerContainer.start();
            LOGGER.info("controlHerdJmsMessageListener(): Done");
        }
    }
    catch (Exception e)
    {
        LOGGER.error("controlHerdJmsMessageListener(): Failed to control the herd Jms message listener service.", e);
    }
}
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:42,
代码来源:HerdJmsMessageListener.java

示例5: registry

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Bean(name = "org.springframework.jms.config.internalJmsListenerEndpointRegistry")
JmsListenerEndpointRegistry registry()
{
    //if Mockito not found return null
    try
    {
        Class.forName("org.mockito.Mockito");
    }
    catch (ClassNotFoundException ignored)
    {
        return null;
    }

    return Mockito.mock(JmsListenerEndpointRegistry.class);
}
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:16,
代码来源:SampleDataJmsMessageListenerTest.java

示例6: testControlListener

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Test
public void testControlListener()
{
    configurationHelper = Mockito.mock(ConfigurationHelper.class);

    ReflectionTestUtils.setField(sampleDataJmsMessageListener, "configurationHelper", configurationHelper);
    MessageListenerContainer mockMessageListenerContainer = Mockito.mock(MessageListenerContainer.class);

    //The listener is not enabled
    when(configurationHelper.getProperty(ConfigurationValue.SAMPLE_DATA_JMS_LISTENER_ENABLED)).thenReturn("false");
    JmsListenerEndpointRegistry registry = ApplicationContextHolder.getApplicationContext()
        .getBean("org.springframework.jms.config.internalJmsListenerEndpointRegistry", JmsListenerEndpointRegistry.class);
    when(registry.getListenerContainer(HerdJmsDestinationResolver.SQS_DESTINATION_SAMPLE_DATA_QUEUE)).thenReturn(mockMessageListenerContainer);
    //the listener is not running, nothing happened
    when(mockMessageListenerContainer.isRunning()).thenReturn(false);
    sampleDataJmsMessageListener.controlSampleDataJmsMessageListener();
    verify(mockMessageListenerContainer, Mockito.times(0)).stop();
    verify(mockMessageListenerContainer, Mockito.times(0)).start();
    // the listener is running, but it is not enable, should stop
    when(mockMessageListenerContainer.isRunning()).thenReturn(true);
    sampleDataJmsMessageListener.controlSampleDataJmsMessageListener();
    verify(mockMessageListenerContainer).stop();

    //The listener is enabled
    when(configurationHelper.getProperty(ConfigurationValue.SAMPLE_DATA_JMS_LISTENER_ENABLED)).thenReturn("true");
    //the listener is running, should not call the start method
    when(mockMessageListenerContainer.isRunning()).thenReturn(true);
    sampleDataJmsMessageListener.controlSampleDataJmsMessageListener();
    verify(mockMessageListenerContainer, Mockito.times(0)).start();
    // the listener is not running, but it is enabled, should start        
    when(mockMessageListenerContainer.isRunning()).thenReturn(false);
    sampleDataJmsMessageListener.controlSampleDataJmsMessageListener();
    verify(mockMessageListenerContainer).start();
}
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:35,
代码来源:SampleDataJmsMessageListenerTest.java

示例7: testControlListener

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Test
public void testControlListener()
{
    ReflectionTestUtils.setField(searchIndexUpdateJmsMessageListener, "configurationHelper", configurationHelper);
    MessageListenerContainer mockMessageListenerContainer = Mockito.mock(MessageListenerContainer.class);

    // The listener is not enabled
    when(configurationHelper.getProperty(ConfigurationValue.SEARCH_INDEX_UPDATE_JMS_LISTENER_ENABLED)).thenReturn("false");
    JmsListenerEndpointRegistry registry = ApplicationContextHolder.getApplicationContext()
        .getBean("org.springframework.jms.config.internalJmsListenerEndpointRegistry", JmsListenerEndpointRegistry.class);
    when(registry.getListenerContainer(HerdJmsDestinationResolver.SQS_DESTINATION_SEARCH_INDEX_UPDATE_QUEUE)).thenReturn(mockMessageListenerContainer);

    // The listener is not running, nothing happened
    when(mockMessageListenerContainer.isRunning()).thenReturn(false);
    searchIndexUpdateJmsMessageListener.controlSearchIndexUpdateJmsMessageListener();
    verify(mockMessageListenerContainer, times(0)).stop();
    verify(mockMessageListenerContainer, times(0)).start();

    // The listener is running, but it is not enable, should stop
    when(mockMessageListenerContainer.isRunning()).thenReturn(true);
    searchIndexUpdateJmsMessageListener.controlSearchIndexUpdateJmsMessageListener();
    verify(mockMessageListenerContainer, times(1)).stop();

    // The listener is enabled
    when(configurationHelper.getProperty(ConfigurationValue.SEARCH_INDEX_UPDATE_JMS_LISTENER_ENABLED)).thenReturn("true");

    // The listener is running, should not call the start method
    when(mockMessageListenerContainer.isRunning()).thenReturn(true);
    searchIndexUpdateJmsMessageListener.controlSearchIndexUpdateJmsMessageListener();
    verify(mockMessageListenerContainer, times(0)).start();

    // The listener is not running, but it is enabled, should start
    when(mockMessageListenerContainer.isRunning()).thenReturn(false);
    searchIndexUpdateJmsMessageListener.controlSearchIndexUpdateJmsMessageListener();
    verify(mockMessageListenerContainer, times(1)).start();
}
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:37,
代码来源:SearchIndexUpdateJmsMessageListenerTest.java

示例8: testControlListener

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Test
 public void testControlListener()
{
     configurationHelper = Mockito.mock(ConfigurationHelper.class);

     ReflectionTestUtils.setField(herdJmsMessageListener, "configurationHelper", configurationHelper);
     MessageListenerContainer mockMessageListenerContainer = Mockito.mock(MessageListenerContainer.class);

     //The listener is not enabled
     when(configurationHelper.getProperty(ConfigurationValue.JMS_LISTENER_ENABLED)).thenReturn("false");
     JmsListenerEndpointRegistry registry = ApplicationContextHolder.getApplicationContext()
             .getBean("org.springframework.jms.config.internalJmsListenerEndpointRegistry", JmsListenerEndpointRegistry.class);
     when(registry.getListenerContainer(HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING)).thenReturn(mockMessageListenerContainer);
     //the listener is not running, nothing happened
     when(mockMessageListenerContainer.isRunning()).thenReturn(false);
     herdJmsMessageListener.controlHerdJmsMessageListener();
     verify(mockMessageListenerContainer, Mockito.times(0)).stop();
     verify(mockMessageListenerContainer, Mockito.times(0)).start();
     // the listener is running, but it is not enable, should stop
     when(mockMessageListenerContainer.isRunning()).thenReturn(true);
     herdJmsMessageListener.controlHerdJmsMessageListener();
     verify(mockMessageListenerContainer).stop();
     
     //The listener is enabled
     when(configurationHelper.getProperty(ConfigurationValue.JMS_LISTENER_ENABLED)).thenReturn("true");
     //the listener is running, should not call the start method
     when(mockMessageListenerContainer.isRunning()).thenReturn(true);
     herdJmsMessageListener.controlHerdJmsMessageListener();
     verify(mockMessageListenerContainer, Mockito.times(0)).start();     
     // the listener is not running, but it is enabled, should start        
     when(mockMessageListenerContainer.isRunning()).thenReturn(false);
     herdJmsMessageListener.controlHerdJmsMessageListener();
     verify(mockMessageListenerContainer).start();
 }
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:35,
代码来源:HerdJmsMessageListenerTest.java

示例9: testControlListener

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Test
public void testControlListener()
{
    configurationHelper = Mockito.mock(ConfigurationHelper.class);

    ReflectionTestUtils.setField(storagePolicyProcessorJmsMessageListener, "configurationHelper", configurationHelper);
    MessageListenerContainer mockMessageListenerContainer = Mockito.mock(MessageListenerContainer.class);

    //The listener is not enabled
    when(configurationHelper.getProperty(ConfigurationValue.STORAGE_POLICY_PROCESSOR_JMS_LISTENER_ENABLED)).thenReturn("false");
    JmsListenerEndpointRegistry registry = ApplicationContextHolder.getApplicationContext()
        .getBean("org.springframework.jms.config.internalJmsListenerEndpointRegistry", JmsListenerEndpointRegistry.class);
    when(registry.getListenerContainer(HerdJmsDestinationResolver.SQS_DESTINATION_STORAGE_POLICY_SELECTOR_JOB_SQS_QUEUE))
        .thenReturn(mockMessageListenerContainer);
    //the listener is not running, nothing happened
    when(mockMessageListenerContainer.isRunning()).thenReturn(false);
    storagePolicyProcessorJmsMessageListener.controlStoragePolicyProcessorJmsMessageListener();
    verify(mockMessageListenerContainer, Mockito.times(0)).stop();
    verify(mockMessageListenerContainer, Mockito.times(0)).start();
    // the listener is running, but it is not enable, should stop
    when(mockMessageListenerContainer.isRunning()).thenReturn(true);
    storagePolicyProcessorJmsMessageListener.controlStoragePolicyProcessorJmsMessageListener();
    verify(mockMessageListenerContainer).stop();

    //The listener is enabled
    when(configurationHelper.getProperty(ConfigurationValue.STORAGE_POLICY_PROCESSOR_JMS_LISTENER_ENABLED)).thenReturn("true");
    //the listener is running, should not call the start method
    when(mockMessageListenerContainer.isRunning()).thenReturn(true);
    storagePolicyProcessorJmsMessageListener.controlStoragePolicyProcessorJmsMessageListener();
    verify(mockMessageListenerContainer, Mockito.times(0)).start();
    // the listener is not running, but it is enabled, should start
    when(mockMessageListenerContainer.isRunning()).thenReturn(false);
    storagePolicyProcessorJmsMessageListener.controlStoragePolicyProcessorJmsMessageListener();
    verify(mockMessageListenerContainer).start();
}
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:36,
代码来源:StoragePolicyProcessorJmsMessageListenerTest.java

示例10: jmsListenerEndpointRegistry

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Bean(name = "jmsListenerEndpointRegistry")
public JmsListenerEndpointRegistry jmsListenerEndpointRegistry() {
    return new JmsListenerEndpointRegistryAdapter();
}
 

开发者ID:kinglcc,
项目名称:spring-boot-jms,
代码行数:5,
代码来源:JmsListenerAutoConfiguration.java

示例11: getEndpointRegistry

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
public JmsListenerEndpointRegistry getEndpointRegistry() {
    return endpointRegistry;
}
 

开发者ID:kinglcc,
项目名称:spring-boot-jms,
代码行数:4,
代码来源:MethodJmsListenerConfigurer.java

示例12: setEndpointRegistry

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
public void setEndpointRegistry(JmsListenerEndpointRegistry endpointRegistry) {
    this.endpointRegistry = endpointRegistry;
}
 

开发者ID:kinglcc,
项目名称:spring-boot-jms,
代码行数:4,
代码来源:MethodJmsListenerConfigurer.java

示例13: defaultJmsListenerEndpointRegistry

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME)
public JmsListenerEndpointRegistry defaultJmsListenerEndpointRegistry() {
	return new JmsListenerEndpointRegistry();
}
 

开发者ID:langtianya,
项目名称:spring4-understanding,
代码行数:5,
代码来源:JmsBootstrapConfiguration.java

示例14: jmsListenerEndpointRegistry

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Bean
public JmsListenerEndpointRegistry jmsListenerEndpointRegistry() {
	return new JmsListenerEndpointRegistry();
}
 

开发者ID:langtianya,
项目名称:spring4-understanding,
代码行数:5,
代码来源:JmsListenerAnnotationBeanPostProcessorTests.java

示例15: customRegistry

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
@Bean
public JmsListenerEndpointRegistry customRegistry() {
	return new JmsListenerEndpointRegistry();
}
 

开发者ID:langtianya,
项目名称:spring4-understanding,
代码行数:5,
代码来源:EnableJmsTests.java

示例16: controlSampleDataJmsMessageListener

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
/**
 * Periodically check the configuration and apply the action to the storage policy processor JMS message listener service, if needed.
 */
@Scheduled(fixedDelay = 60000)
public void controlSampleDataJmsMessageListener()
{
    try
    {
        // Get the configuration setting.
        Boolean jmsMessageListenerEnabled =
            Boolean.valueOf(configurationHelper.getProperty(ConfigurationValue.SAMPLE_DATA_JMS_LISTENER_ENABLED));

        // Get the registry bean.
        JmsListenerEndpointRegistry registry = ApplicationContextHolder.getApplicationContext()
            .getBean("org.springframework.jms.config.internalJmsListenerEndpointRegistry", JmsListenerEndpointRegistry.class);

        // Get the sample data JMS message listener container.
        MessageListenerContainer jmsMessageListenerContainer =
            registry.getListenerContainer(HerdJmsDestinationResolver.SQS_DESTINATION_SAMPLE_DATA_QUEUE);

        // Get the current JMS message listener status and the configuration value.
        LOGGER.debug("controlStoragePolicyProcessorJmsMessageListener(): {}={} jmsMessageListenerContainer.isRunning()={}",
            ConfigurationValue.SAMPLE_DATA_JMS_LISTENER_ENABLED.getKey(), jmsMessageListenerEnabled, jmsMessageListenerContainer.isRunning());

        // Apply the relative action if needed.
        if (!jmsMessageListenerEnabled && jmsMessageListenerContainer.isRunning())
        {
            LOGGER.info("controlSampleDataJmsMessageListener(): Stopping the sample data JMS message listener ...");
            jmsMessageListenerContainer.stop();
            LOGGER.info("controlSampleDataJmsMessageListener(): Done");
        }
        else if (jmsMessageListenerEnabled && !jmsMessageListenerContainer.isRunning())
        {
            LOGGER.info("controlSampleDataJmsMessageListener(): Starting the sample data JMS message listener ...");
            jmsMessageListenerContainer.start();
            LOGGER.info("controlSampleDataJmsMessageListener(): Done");
        }
    }
    catch (Exception e)
    {
        LOGGER.error("controlSampleDataJmsMessageListener(): Failed to control the sample data Jms message listener service.", e);
    }
}
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:44,
代码来源:SampleDataJmsMessageListener.java

示例17: controlStoragePolicyProcessorJmsMessageListener

点赞 2

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
/**
 * Periodically check the configuration and apply the action to the storage policy processor JMS message listener service, if needed.
 */
@Scheduled(fixedDelay = 60000)
public void controlStoragePolicyProcessorJmsMessageListener()
{
    try
    {
        // Get the configuration setting.
        Boolean jmsMessageListenerEnabled =
            Boolean.valueOf(configurationHelper.getProperty(ConfigurationValue.STORAGE_POLICY_PROCESSOR_JMS_LISTENER_ENABLED));

        // Get the registry bean.
        JmsListenerEndpointRegistry registry = ApplicationContextHolder.getApplicationContext()
            .getBean("org.springframework.jms.config.internalJmsListenerEndpointRegistry", JmsListenerEndpointRegistry.class);

        // Get the storage policy processor JMS message listener container.
        MessageListenerContainer jmsMessageListenerContainer =
            registry.getListenerContainer(HerdJmsDestinationResolver.SQS_DESTINATION_STORAGE_POLICY_SELECTOR_JOB_SQS_QUEUE);

        // Get the current JMS message listener status and the configuration value.
        LOGGER.debug("controlStoragePolicyProcessorJmsMessageListener(): {}={} jmsMessageListenerContainer.isRunning()={}",
            ConfigurationValue.STORAGE_POLICY_PROCESSOR_JMS_LISTENER_ENABLED.getKey(), jmsMessageListenerEnabled, jmsMessageListenerContainer.isRunning());

        // Apply the relative action if needed.
        if (!jmsMessageListenerEnabled && jmsMessageListenerContainer.isRunning())
        {
            LOGGER.info("controlStoragePolicyProcessorJmsMessageListener(): Stopping the storage policy processor JMS message listener ...");
            jmsMessageListenerContainer.stop();
            LOGGER.info("controlStoragePolicyProcessorJmsMessageListener(): Done");
        }
        else if (jmsMessageListenerEnabled && !jmsMessageListenerContainer.isRunning())
        {
            LOGGER.info("controlStoragePolicyProcessorJmsMessageListener(): Starting the storage policy processor JMS message listener ...");
            jmsMessageListenerContainer.start();
            LOGGER.info("controlStoragePolicyProcessorJmsMessageListener(): Done");
        }
    }
    catch (Exception e)
    {
        LOGGER.error("controlStoragePolicyProcessorJmsMessageListener(): Failed to control the storage policy processor Jms message listener service.", e);
    }
}
 

开发者ID:FINRAOS,
项目名称:herd,
代码行数:44,
代码来源:StoragePolicyProcessorJmsMessageListener.java

示例18: setEndpointRegistry

点赞 1

import org.springframework.jms.config.JmsListenerEndpointRegistry; //导入依赖的package包/类
/**
 * Set the {@link JmsListenerEndpointRegistry} that will hold the created
 * endpoint and manage the lifecycle of the related listener container.
 */
public void setEndpointRegistry(JmsListenerEndpointRegistry endpointRegistry) {
	this.endpointRegistry = endpointRegistry;
}
 

开发者ID:langtianya,
项目名称:spring4-understanding,
代码行数:8,
代码来源:JmsListenerAnnotationBeanPostProcessor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)