camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] git commit: CAMEL-7649: camel-jms - The QueueBrowseStrategy need support for JMS Selector.
Date Tue, 12 Aug 2014 08:38:50 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x ef824f2a0 -> 87746aa60


CAMEL-7649: camel-jms - The QueueBrowseStrategy need support for JMS Selector.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/87746aa6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/87746aa6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/87746aa6

Branch: refs/heads/camel-2.12.x
Commit: 87746aa60dc2f83d3843911f02fafd6d0afb7543
Parents: a73ea67
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Aug 12 10:37:34 2014 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Aug 12 10:38:38 2014 +0200

----------------------------------------------------------------------
 .../jms/DefaultQueueBrowseStrategy.java         | 76 ++++++++++----------
 .../camel/component/jms/JmsQueueEndpoint.java   |  6 +-
 .../component/jms/QueueBrowseStrategy.java      |  2 -
 3 files changed, 39 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/87746aa6/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
b/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
index f5cb164..3258d61 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
@@ -37,47 +37,47 @@ import org.springframework.jms.core.JmsOperations;
 public class DefaultQueueBrowseStrategy implements QueueBrowseStrategy {
 
     public List<Exchange> browse(JmsOperations template, String queue, final JmsQueueEndpoint
endpoint) {
-        return template.browse(queue, new BrowserCallback<List<Exchange>>() {
-            public List<Exchange> doInJms(Session session, QueueBrowser browser) throws
JMSException {
-                int size = endpoint.getMaximumBrowseSize();
-                if (size <= 0) {
-                    size = Integer.MAX_VALUE;
-                }
+        if (endpoint.getSelector() != null) {
+            return template.browseSelected(queue, endpoint.getSelector(), new BrowserCallback<List<Exchange>>()
{
+                public List<Exchange> doInJms(Session session, QueueBrowser browser)
throws JMSException {
+                    int size = endpoint.getMaximumBrowseSize();
+                    if (size <= 0) {
+                        size = Integer.MAX_VALUE;
+                    }
 
-                // not the best implementation in the world as we have to browse
-                // the entire queue, which could be massive
-                List<Exchange> answer = new ArrayList<Exchange>();
-                Enumeration<?> iter = browser.getEnumeration();
-                for (int i = 0; i < size && iter.hasMoreElements(); i++) {
-                    Message message = (Message) iter.nextElement();
-                    Exchange exchange = endpoint.createExchange(message);
-                    answer.add(exchange);
+                    // not the best implementation in the world as we have to browse
+                    // the entire queue, which could be massive
+                    List<Exchange> answer = new ArrayList<Exchange>();
+                    Enumeration<?> iter = browser.getEnumeration();
+                    for (int i = 0; i < size && iter.hasMoreElements(); i++) {
+                        Message message = (Message) iter.nextElement();
+                        Exchange exchange = endpoint.createExchange(message);
+                        answer.add(exchange);
+                    }
+                    return answer;
                 }
-                return answer;
-            }
-        });
-    }
+            });
+        } else {
+            return template.browse(queue, new BrowserCallback<List<Exchange>>()
{
+                public List<Exchange> doInJms(Session session, QueueBrowser browser)
throws JMSException {
+                    int size = endpoint.getMaximumBrowseSize();
+                    if (size <= 0) {
+                        size = Integer.MAX_VALUE;
+                    }
 
-    @Override
-    public List<Exchange> browseSelected(final String selector, final JmsOperations
template, final String queue, final JmsQueueEndpoint endpoint) {
-        return template.browseSelected(queue, selector, new BrowserCallback<List<Exchange>>()
{
-            public List<Exchange> doInJms(Session session, QueueBrowser browser) throws
JMSException {
-                int size = endpoint.getMaximumBrowseSize();
-                if (size <= 0) {
-                    size = Integer.MAX_VALUE;
+                    // not the best implementation in the world as we have to browse
+                    // the entire queue, which could be massive
+                    List<Exchange> answer = new ArrayList<Exchange>();
+                    Enumeration<?> iter = browser.getEnumeration();
+                    for (int i = 0; i < size && iter.hasMoreElements(); i++) {
+                        Message message = (Message) iter.nextElement();
+                        Exchange exchange = endpoint.createExchange(message);
+                        answer.add(exchange);
+                    }
+                    return answer;
                 }
-
-                // not the best implementation in the world as we have to browse
-                // the entire queue, which could be massive
-                List<Exchange> answer = new ArrayList<Exchange>();
-                Enumeration<?> iter = browser.getEnumeration();
-                for (int i = 0; i < size && iter.hasMoreElements(); i++) {
-                    Message message = (Message) iter.nextElement();
-                    Exchange exchange = endpoint.createExchange(message);
-                    answer.add(exchange);
-                }
-                return answer;
-            }
-        });
+            });
+        }
     }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/87746aa6/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java
b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java
index e71c577..cafc1c1 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java
@@ -95,11 +95,7 @@ public class JmsQueueEndpoint extends JmsEndpoint implements BrowsableEndpoint
{
         }
         String queue = getDestinationName();
         JmsOperations template = getConfiguration().createInOnlyTemplate(this, false, queue);
-        if (getSelector() != null) {
-            return queueBrowseStrategy.browseSelected(getSelector(), template, queue, this);
-        } else {
-            return queueBrowseStrategy.browse(template, queue, this);
-        }
+        return queueBrowseStrategy.browse(template, queue, this);
     }
 
     @ManagedOperation(description = "Current number of Exchanges in Queue")

http://git-wip-us.apache.org/repos/asf/camel/blob/87746aa6/components/camel-jms/src/main/java/org/apache/camel/component/jms/QueueBrowseStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/QueueBrowseStrategy.java
b/components/camel-jms/src/main/java/org/apache/camel/component/jms/QueueBrowseStrategy.java
index 44727a2..d973206 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/QueueBrowseStrategy.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/QueueBrowseStrategy.java
@@ -28,6 +28,4 @@ public interface QueueBrowseStrategy {
 
     List<Exchange> browse(JmsOperations template, String queue, JmsQueueEndpoint endpoint);
 
-    List<Exchange> browseSelected(String selector, JmsOperations template, String queue,
JmsQueueEndpoint endpoint);
-
 }


Mime
View raw message