View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.jms;
8   
9   import org.mule.api.endpoint.ImmutableEndpoint;
10  
11  import javax.jms.Destination;
12  
13  /**
14   * A strategy interface to detect a {@code javax.jms.Topic} in,
15   * possibly, a vendor-specific way.
16   */
17  public interface JmsTopicResolver
18  {
19      /**
20       * Use endpoint configuration to detect a topic.
21       * @param endpoint endpoint to test
22       * @return true if endpoint's config tells it's a topic
23       * @see #isTopic(org.mule.api.endpoint.ImmutableEndpoint, boolean)
24       */
25      boolean isTopic(ImmutableEndpoint endpoint);
26  
27      /**
28       * Use endpoint configuration to detect a topic. Additionally,
29       * specify a fallback mechanism to search in endpoint's properties
30       * in case resource info yields {@code false}. In case resource info
31       * returned {@code true} no endpoint properties would be consulted.
32       * @param endpoint endpoint to test
33       * @param fallbackToEndpointProperties  whether to check endpoint's properties if
34       *        resource info returned false
35       * @return true if endpoint's config tells it's a topic
36       */
37      boolean isTopic(ImmutableEndpoint endpoint, boolean fallbackToEndpointProperties);
38  
39      /**
40       * Use any means suitable to detect a topic. This can
41       * be as simple as an {@code instanceof} call or utilize
42       * reflection and/or vendor API instead. 
43       * @param destination a jms destination to test
44       * @return {@code true} for topic
45       */
46      boolean isTopic(Destination destination);
47  }
48