/** * Create a message listener container for the given {@link JmsListenerEndpoint}. * <p>This create the necessary infrastructure to honor that endpoint * with regards to its configuration. * <p>The {@code startImmediately} flag determines if the container should be * started immediately. * @param endpoint the endpoint to add * @param factory the listener factory to use * @param startImmediately start the container immediately if necessary * @see #getListenerContainers() * @see #getListenerContainer(String) */ public void registerListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory, boolean startImmediately) { Assert.notNull(endpoint, "Endpoint must not be null"); Assert.notNull(factory, "Factory must not be null"); String id = endpoint.getId(); Assert.hasText(id, "Endpoint id must be set"); synchronized (this.listenerContainers) { if (this.listenerContainers.containsKey(id)) { throw new IllegalStateException("Another endpoint is already registered with id '" + id + "'"); } MessageListenerContainer container = createListenerContainer(endpoint, factory); this.listenerContainers.put(id, container); if (startImmediately) { startIfNecessary(container); } } }
/** * Create a message listener container for the given {@link JmsListenerEndpoint}. * <p>This create the necessary infrastructure to honor that endpoint * with regards to its configuration. * <p>The {@code startImmediately} flag determines if the container should be * started immediately. * @param endpoint the endpoint to add * @param factory the listener factory to use * @param startImmediately start the container immediately if necessary * @see #getListenerContainers() * @see #getListenerContainer(String) */ public void registerListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory, boolean startImmediately) { Assert.notNull(endpoint, "Endpoint must not be null"); Assert.notNull(factory, "Factory must not be null"); String id = endpoint.getId(); Assert.hasText(id, "Endpoint id must be set"); synchronized (this.listenerContainers) { if (this.listenerContainers.containsKey(id)) { throw new IllegalStateException("Another endpoint is already registered with id '" + id + "'"); } MessageListenerContainer container = createListenerContainer(endpoint, factory); this.listenerContainers.put(id, container); if (startImmediately) { startIfNecessary(container); } } }
/** * Create a message listener container for the given {@link JmsListenerEndpoint}. * <p>This create the necessary infrastructure to honor that endpoint * with regards to its configuration. * <p>The {@code startImmediately} flag determines if the container should be * started immediately. * @param endpoint the endpoint to add * @param factory the listener factory to use * @param startImmediately start the container immediately if necessary * @see #getListenerContainers() * @see #getListenerContainer(String) */ public void registerListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory, boolean startImmediately) { Assert.notNull(endpoint, "Endpoint must not be null"); Assert.notNull(factory, "Factory must not be null"); String id = endpoint.getId(); Assert.notNull(id, "Endpoint id must not be null"); synchronized (this.listenerContainers) { if (this.listenerContainers.containsKey(id)) { throw new IllegalStateException("Another endpoint is already registered with id '" + id + "'"); } MessageListenerContainer container = createListenerContainer(endpoint, factory); this.listenerContainers.put(id, container); if (startImmediately) { startIfNecessary(container); } } }