diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-07-21 15:43:59 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-07-21 15:43:59 +0000 |
| commit | 07e2da7a5d9cc0e737bb9f820fcaf58544242269 (patch) | |
| tree | 0bc4bec8abd69255dea0dc60d34077098c9fc710 /java/client | |
| parent | f66202efc1d42ebc8a636d399c31c05df2d13af1 (diff) | |
| download | qpid-python-07e2da7a5d9cc0e737bb9f820fcaf58544242269.tar.gz | |
QPID-2738
You could now susbcribe to any queue using browse mode and use a regular MessageConsumer (even with a MessageListener) instead of having to use a Queue Browser.
Ex. 'my-ring-queue; {mode: browse}'
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@966284 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client')
3 files changed, 10 insertions, 24 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java b/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java index 4e8c5836e0..0dc702dcbc 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java @@ -121,8 +121,6 @@ public abstract class AMQDestination implements Destination, Referenceable } } - - protected static DestSyntax defaultDestSyntax; protected DestSyntax _destSyntax; @@ -140,6 +138,7 @@ public abstract class AMQDestination implements Destination, Referenceable protected Node _sourceNode; protected Link _targetLink; protected Link _link; + // ----- / Fields required to support new address syntax ------- static @@ -390,7 +389,7 @@ public abstract class AMQDestination implements Destination, Referenceable { return _isExclusive; } - + public boolean isAutoDelete() { return _isAutoDelete; @@ -838,6 +837,8 @@ public abstract class AMQDestination implements Destination, Referenceable _delete = _addrHelper.getDelete() != null ? AddressOption.getOption(_addrHelper.getDelete()):AddressOption.NEVER; + + _browseOnly = _addrHelper.isBrowseOnly(); _addressType = _addrHelper.getTargetNodeType(); _targetNode = _addrHelper.getTargetNode(_addressType); diff --git a/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java index 73987d8b75..5c6da08723 100644 --- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java +++ b/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java @@ -693,23 +693,7 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa { _logger.debug("Message is of type: " + jmsMessage.getClass().getName()); } - // synchronized (_closed) - - { - // if (!_closed.get()) - { - - //preDeliver(jmsMessage); - - notifyMessage(jmsMessage); - } - // else - // { - // _logger.error("MESSAGE REJECTING!"); - // _session.rejectMessage(jmsMessage, true); - // //_logger.error("MESSAGE JUST DROPPED!"); - // } - } + notifyMessage(jmsMessage); } catch (Exception e) { @@ -973,7 +957,7 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa public boolean isNoConsume() { - return _noConsume; + return _noConsume || _destination.isBrowseOnly() ; } public void rollback() diff --git a/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java b/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java index 50757931aa..12758c2d88 100644 --- a/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java +++ b/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java @@ -56,7 +56,8 @@ public class AddressHelper public static final String TYPE = "type"; public static final String ALT_EXCHANGE = "alt-exchange"; public static final String BINDINGS = "bindings"; - public static final String BROWSE_ONLY = "browse"; + public static final String BROWSE = "browse"; + public static final String MODE = "mode"; public static final String CAPACITY = "capacity"; public static final String CAPACITY_SOURCE = "source"; public static final String CAPACITY_TARGET = "target"; @@ -112,8 +113,8 @@ public class AddressHelper public boolean isBrowseOnly() { - Boolean b = nodeProps.getBoolean(BROWSE_ONLY); - return b == null ? false : b ; + String mode = addressProps.getString(MODE); + return mode != null && mode.equals(BROWSE) ? true : false ; } public QpidQueueOptions getQpidQueueOptions(MapAccessor args) |
