org.springframework.jms.config.JmsListenerEndpoint Java Examples

The following examples show how to use org.springframework.jms.config.JmsListenerEndpoint. 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: AbstractJmsAnnotationDrivenTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * 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"));
}
 
Example #2
Source File: JmsChannelModelProcessor.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected JmsListenerContainerFactory<?> resolveContainerFactory(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> containerFactory) {
    if (containerFactory != null) {
        return containerFactory;
    } else if (this.containerFactory != null) {
        return this.containerFactory;
    } else if (containerFactoryBeanName != null) {
        Assert.state(beanFactory != null, "BeanFactory must be set to obtain container factory by bean name");
        // Consider changing this if live change of the factory is required...
        this.containerFactory = beanFactory.getBean(containerFactoryBeanName, JmsListenerContainerFactory.class);
        return this.containerFactory;
    } else {
        throw new IllegalStateException("Could not resolve the " +
            JmsListenerContainerFactory.class.getSimpleName() + " to use for [" +
            endpoint + "] no factory was given and no default is set.");
    }
}
 
Example #3
Source File: AbstractJmsAnnotationDrivenTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * 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"));
}
 
Example #4
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void sendToAnnotationFoundOnProxy() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, ProxyConfig.class, ProxyTestBean.class);
	try {
		JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
		assertEquals("one container should have been registered", 1, factory.getListenerContainers().size());

		JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
		assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
		MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
		assertTrue(AopUtils.isJdkDynamicProxy(methodEndpoint.getBean()));
		assertTrue(methodEndpoint.getBean() instanceof SimpleService);
		assertEquals(SimpleService.class.getMethod("handleIt", String.class), methodEndpoint.getMethod());
		assertEquals(ProxyTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMostSpecificMethod());

		Method m = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination");
		ReflectionUtils.makeAccessible(m);
		Object destination = ReflectionUtils.invokeMethod(m, endpoint);
		assertEquals("SendTo annotation not found on proxy", "foobar", destination);
	}
	finally {
		context.close();
	}
}
 
Example #5
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void metaAnnotationIsDiscovered() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, MetaAnnotationTestBean.class);

	try {
		JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
		assertEquals("one container should have been registered", 1, factory.getListenerContainers().size());

		JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
		assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
		MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
		assertEquals(MetaAnnotationTestBean.class, methodEndpoint.getBean().getClass());
		assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMethod());
		assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMostSpecificMethod());
		assertEquals("metaTestQueue", ((AbstractJmsListenerEndpoint) endpoint).getDestination());
	}
	finally {
		context.close();
	}
}
 
Example #6
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void simpleMessageListener() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, SimpleMessageListenerTestBean.class);

	JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
	assertEquals("One container should have been registered", 1, factory.getListenerContainers().size());
	MessageListenerTestContainer container = factory.getListenerContainers().get(0);

	JmsListenerEndpoint endpoint = container.getEndpoint();
	assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
	MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
	assertEquals(SimpleMessageListenerTestBean.class, methodEndpoint.getBean().getClass());
	assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMethod());
	assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMostSpecificMethod());

	SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer();
	methodEndpoint.setupListenerContainer(listenerContainer);
	assertNotNull(listenerContainer.getMessageListener());

	assertTrue("Should have been started " + container, container.isStarted());
	context.close(); // Close and stop the listeners
	assertTrue("Should have been stopped " + container, container.isStopped());
}
 
Example #7
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void simpleMessageListener() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, SimpleMessageListenerTestBean.class);

	JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
	assertEquals("One container should have been registered", 1, factory.getListenerContainers().size());
	MessageListenerTestContainer container = factory.getListenerContainers().get(0);

	JmsListenerEndpoint endpoint = container.getEndpoint();
	assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
	MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
	assertEquals(SimpleMessageListenerTestBean.class, methodEndpoint.getBean().getClass());
	assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class),
			methodEndpoint.getMethod());
	assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class),
			methodEndpoint.getMostSpecificMethod());

	SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer();
	methodEndpoint.setupListenerContainer(listenerContainer);
	assertNotNull(listenerContainer.getMessageListener());

	assertTrue("Should have been started " + container, container.isStarted());
	context.close(); // Close and stop the listeners
	assertTrue("Should have been stopped " + container, container.isStopped());
}
 
Example #8
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void metaAnnotationIsDiscovered() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, MetaAnnotationTestBean.class);

	try {
		JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
		assertEquals("one container should have been registered", 1, factory.getListenerContainers().size());

		JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
		assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
		MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
		assertEquals(MetaAnnotationTestBean.class, methodEndpoint.getBean().getClass());
		assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class),
				methodEndpoint.getMethod());
		assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class),
				methodEndpoint.getMostSpecificMethod());
		assertEquals("metaTestQueue", ((AbstractJmsListenerEndpoint) endpoint).getDestination());
	}
	finally {
		context.close();
	}
}
 
Example #9
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void simpleMessageListener() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, SimpleMessageListenerTestBean.class);

	JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
	assertEquals("One container should have been registered", 1, factory.getListenerContainers().size());
	MessageListenerTestContainer container = factory.getListenerContainers().get(0);

	JmsListenerEndpoint endpoint = container.getEndpoint();
	assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
	MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
	assertEquals(SimpleMessageListenerTestBean.class, methodEndpoint.getBean().getClass());
	assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class),
			methodEndpoint.getMethod());
	assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class),
			methodEndpoint.getMostSpecificMethod());

	SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer();
	methodEndpoint.setupListenerContainer(listenerContainer);
	assertNotNull(listenerContainer.getMessageListener());

	assertTrue("Should have been started " + container, container.isStarted());
	context.close(); // Close and stop the listeners
	assertTrue("Should have been stopped " + container, container.isStopped());
}
 
Example #10
Source File: AbstractJmsAnnotationDrivenTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * 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"));
}
 
Example #11
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void metaAnnotationIsDiscovered() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, MetaAnnotationTestBean.class);

	try {
		JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
		assertEquals("one container should have been registered", 1, factory.getListenerContainers().size());

		JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
		assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
		MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
		assertEquals(MetaAnnotationTestBean.class, methodEndpoint.getBean().getClass());
		assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class),
				methodEndpoint.getMethod());
		assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class),
				methodEndpoint.getMostSpecificMethod());
		assertEquals("metaTestQueue", ((AbstractJmsListenerEndpoint) endpoint).getDestination());
	}
	finally {
		context.close();
	}
}
 
Example #12
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void sendToAnnotationFoundOnInterfaceProxy() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, ProxyConfig.class, InterfaceProxyTestBean.class);
	try {
		JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
		assertEquals("one container should have been registered", 1, factory.getListenerContainers().size());

		JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
		assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
		MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
		assertTrue(AopUtils.isJdkDynamicProxy(methodEndpoint.getBean()));
		assertTrue(methodEndpoint.getBean() instanceof SimpleService);
		assertEquals(SimpleService.class.getMethod("handleIt", String.class, String.class),
				methodEndpoint.getMethod());
		assertEquals(InterfaceProxyTestBean.class.getMethod("handleIt", String.class, String.class),
				methodEndpoint.getMostSpecificMethod());

		Method method = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination");
		ReflectionUtils.makeAccessible(method);
		Object destination = ReflectionUtils.invokeMethod(method, endpoint);
		assertEquals("SendTo annotation not found on proxy", "foobar", destination);
	}
	finally {
		context.close();
	}
}
 
Example #13
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void sendToAnnotationFoundOnCglibProxy() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, ProxyConfig.class, ClassProxyTestBean.class);
	try {
		JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
		assertEquals("one container should have been registered", 1, factory.getListenerContainers().size());

		JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
		assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
		MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
		assertTrue(AopUtils.isCglibProxy(methodEndpoint.getBean()));
		assertTrue(methodEndpoint.getBean() instanceof ClassProxyTestBean);
		assertEquals(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class),
				methodEndpoint.getMethod());
		assertEquals(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class),
				methodEndpoint.getMostSpecificMethod());

		Method method = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination");
		ReflectionUtils.makeAccessible(method);
		Object destination = ReflectionUtils.invokeMethod(method, endpoint);
		assertEquals("SendTo annotation not found on proxy", "foobar", destination);
	}
	finally {
		context.close();
	}
}
 
Example #14
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void sendToAnnotationFoundOnCglibProxy() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, ProxyConfig.class, ClassProxyTestBean.class);
	try {
		JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
		assertEquals("one container should have been registered", 1, factory.getListenerContainers().size());

		JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
		assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
		MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
		assertTrue(AopUtils.isCglibProxy(methodEndpoint.getBean()));
		assertTrue(methodEndpoint.getBean() instanceof ClassProxyTestBean);
		assertEquals(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class),
				methodEndpoint.getMethod());
		assertEquals(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class),
				methodEndpoint.getMostSpecificMethod());

		Method method = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination");
		ReflectionUtils.makeAccessible(method);
		Object destination = ReflectionUtils.invokeMethod(method, endpoint);
		assertEquals("SendTo annotation not found on proxy", "foobar", destination);
	}
	finally {
		context.close();
	}
}
 
Example #15
Source File: JmsListenerAnnotationBeanPostProcessorTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void sendToAnnotationFoundOnInterfaceProxy() throws Exception {
	ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
			Config.class, ProxyConfig.class, InterfaceProxyTestBean.class);
	try {
		JmsListenerContainerTestFactory factory = context.getBean(JmsListenerContainerTestFactory.class);
		assertEquals("one container should have been registered", 1, factory.getListenerContainers().size());

		JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
		assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
		MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
		assertTrue(AopUtils.isJdkDynamicProxy(methodEndpoint.getBean()));
		assertTrue(methodEndpoint.getBean() instanceof SimpleService);
		assertEquals(SimpleService.class.getMethod("handleIt", String.class, String.class),
				methodEndpoint.getMethod());
		assertEquals(InterfaceProxyTestBean.class.getMethod("handleIt", String.class, String.class),
				methodEndpoint.getMostSpecificMethod());

		Method method = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination");
		ReflectionUtils.makeAccessible(method);
		Object destination = ReflectionUtils.invokeMethod(method, endpoint);
		assertEquals("SendTo annotation not found on proxy", "foobar", destination);
	}
	finally {
		context.close();
	}
}
 
Example #16
Source File: JmsChannelModelProcessor.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void registerChannelModel(ChannelModel channelModel, String tenantId, EventRegistry eventRegistry, 
                EventRepositoryService eventRepositoryService, boolean fallbackToDefaultTenant) {
    
    if (channelModel instanceof JmsInboundChannelModel) {
        JmsInboundChannelModel jmsChannelModel = (JmsInboundChannelModel) channelModel;

        JmsListenerEndpoint endpoint = createJmsListenerEndpoint(jmsChannelModel, tenantId, eventRegistry);
        registerEndpoint(endpoint, null);
        
    } else if (channelModel instanceof JmsOutboundChannelModel) {
        processOutboundDefinition((JmsOutboundChannelModel) channelModel);
    }
}
 
Example #17
Source File: JmsChannelModelProcessor.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected JmsListenerEndpoint createJmsListenerEndpoint(JmsInboundChannelModel jmsChannelModel, String tenantId, EventRegistry eventRegistry) {
    
    String endpointId = getEndpointId(jmsChannelModel, tenantId);

    SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();

    endpoint.setId(endpointId);
    endpoint.setDestination(resolve(jmsChannelModel.getDestination()));

    String selector = jmsChannelModel.getSelector();
    if (StringUtils.hasText(selector)) {
        endpoint.setSelector(resolve(selector));
    }

    String subscription = jmsChannelModel.getSubscription();
    if (StringUtils.hasText(subscription)) {
        endpoint.setSubscription(resolve(subscription));
    }

    String concurrency = jmsChannelModel.getConcurrency();
    if (StringUtils.hasText(concurrency)) {
        endpoint.setConcurrency(resolve(concurrency));
    }

    endpoint.setMessageListener(createMessageListener(eventRegistry, jmsChannelModel));
    return endpoint;
}
 
Example #18
Source File: JmsChannelModelProcessor.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
/**
 * Register a new {@link JmsListenerEndpoint} alongside the
 * {@link JmsListenerContainerFactory} to use to create the underlying container.
 * <p>The {@code factory} may be {@code null} if the default factory has to be
 * used for that endpoint.
 */
protected void registerEndpoint(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory) {
    Assert.notNull(endpoint, "Endpoint must not be null");
    Assert.hasText(endpoint.getId(), "Endpoint id must be set");

    Assert.state(this.endpointRegistry != null, "No JmsListenerEndpointRegistry set");
    endpointRegistry.registerListenerContainer(endpoint, resolveContainerFactory(endpoint, factory), true);
}