View Javadoc
1   /*
2    * Copyright 2002-2012 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.jms.support.destination;
18  
19  import javax.jms.Destination;
20  import javax.jms.JMSException;
21  import javax.jms.Session;
22  
23  /**
24   * Strategy interface for resolving JMS destinations.
25   *
26   * <p>Used by {@link org.springframework.jms.core.JmsTemplate} for resolving
27   * destination names from simple {@link String Strings} to actual
28   * {@link Destination} implementation instances.
29   *
30   * <p>The default {@link DestinationResolver} implementation used by
31   * {@link org.springframework.jms.core.JmsTemplate} instances is the
32   * {@link DynamicDestinationResolver} class. Consider using the
33   * {@link JndiDestinationResolver} for more advanced scenarios.
34   *
35   * @author Juergen Hoeller
36   * @since 1.1
37   * @see org.springframework.jms.core.JmsTemplate#setDestinationResolver
38   * @see org.springframework.jms.support.destination.DynamicDestinationResolver
39   * @see org.springframework.jms.support.destination.JndiDestinationResolver
40   */
41  public interface DestinationResolver {
42  
43  	/**
44  	 * Resolve the given destination name, either as located resource
45  	 * or as dynamic destination.
46  	 * @param session the current JMS Session
47  	 * (may be {@code null} if the resolver implementation is able to work without it)
48  	 * @param destinationName the name of the destination
49  	 * @param pubSubDomain {@code true} if the domain is pub-sub, {@code false} if P2P
50  	 * @return the JMS destination (either a topic or a queue)
51  	 * @throws javax.jms.JMSException if the JMS Session failed to resolve the destination
52  	 * @throws DestinationResolutionException in case of general destination resolution failure
53  	 */
54  	Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain)
55  			throws JMSException;
56  
57  }