Example usage for org.springframework.jms.config JmsListenerEndpoint getId

List of usage examples for org.springframework.jms.config JmsListenerEndpoint getId

Introduction

In this page you can find the example usage for org.springframework.jms.config JmsListenerEndpoint getId.

Prototype

String getId();

Source Link

Document

Return the id of this endpoint.

Usage

From source file:com.kinglcc.spring.jms.core.listener.DynamicJmsListenerContainerFactory.java

private String resolveClientId(JmsListenerEndpoint endpoint) {
    if (StringUtils.contains(endpoint.getId(), DEFAULT_ENDPOITID)) {
        return clientIdGenerator.generateId();
    }/*from   www.j a  v  a2  s.  c o  m*/
    return clientIdGenerator.generateId(endpoint.getId());
}

From source file:org.springframework.jms.config.JmsListenerEndpointRegistry.java

/**
 * 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./*from ww w. ja  v  a  2  s .  c  o m*/
 * <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);
        }
    }
}