Author: arnaudsimon
Date: Tue Oct 2 07:17:26 2007
New Revision: 581254
URL: http://svn.apache.org/viewvc?rev=581254&view=rev
Log:
Changed to use bindingquery
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java?rev=581254&r1=581253&r2=581254&view=diff
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
Tue Oct 2 07:17:26 2007
@@ -32,6 +32,8 @@
import org.apache.qpidity.QpidException;
import org.apache.qpidity.transport.RangeSet;
import org.apache.qpidity.transport.Option;
+import org.apache.qpidity.transport.BindingQueryResult;
+import org.apache.qpidity.transport.Future;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -295,9 +297,13 @@
public boolean isQueueBound(final AMQShortString exchangeName, final
AMQShortString queueName,
final AMQShortString routingKey) throws
JMSException
{
- getQpidSession().queueBind(queueName.toString(),
exchangeName.toString(), routingKey.toString(), null);
- // we asume that a binding is always successful
- return true;
+ Future<BindingQueryResult> result =
getQpidSession().bindingQuery(exchangeName.toString(), queueName.toString(),
routingKey.toString(), null);
+ BindingQueryResult bindingQueryResult = result.get();
+ return ! (bindingQueryResult.getArgsNotMatched() ||
+ bindingQueryResult.getExchangeNotFound() ||
+ bindingQueryResult.getKeyNotMatched() ||
+ bindingQueryResult.getQueueNotFound() ||
+ bindingQueryResult.getQueueNotMatched());
}
/**
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java?rev=581254&r1=581253&r2=581254&view=diff
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
Tue Oct 2 07:17:26 2007
@@ -142,5 +142,11 @@
}
}
+
+
+ public boolean isBound(AMQDestination destination) throws JMSException
+ {
+ return _session.isQueueBound(destination.getExchangeName(),
destination.getAMQQueueName(), destination.getRoutingKey());
+ }
}
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java?rev=581254&r1=581253&r2=581254&view=diff
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
Tue Oct 2 07:17:26 2007
@@ -481,7 +481,8 @@
* [EMAIL PROTECTED] Option#EXCLUSIVE}, [EMAIL
PROTECTED] Option#PASSIVE} and [EMAIL PROTECTED] Option#NO_OPTION})
* @see Option
*/
- public void queueDeclare(String queueName, String alternateExchange,
Map<String, Object> arguments, Option... options);
+ public void queueDeclare(String queueName, String alternateExchange,
Map<String, Object> arguments,
+ Option... options);
/**
* Bind a queue with an exchange.
@@ -542,6 +543,28 @@
*/
public void queueDelete(String queueName, Option... options);
+
+ /**
+ * This method is used to request information on a particular queue.
+ *
+ * @param queueName The name of the queue for which information is
requested.
+ * @return Information on the specified queue.
+ */
+ public Future<QueueQueryResult> queueQuery(String queueName);
+
+
+ /**
+ * This method is used to request information on a particular binding.
+ *
+ * @param exchange The exchange name.
+ * @param queue The queue name.
+ * @param routingKey The routing key
+ * @param arguments bacward compatibilties params.
+ * @return Information on the specified binding.
+ */
+ public Future<BindingQueryResult> bindingQuery(String exchange, String
queue, String routingKey,
+ Map<String, Object>
arguments);
+
// --------------------------------------
// exhcange methods
// --------------------------------------
@@ -573,8 +596,8 @@
* @param arguments Used for backward compatibility
* @see Option
*/
- public void exchangeDeclare(String exchangeName, String type, String
alternateExchange, Map<String, Object> arguments,
- Option... options);
+ public void exchangeDeclare(String exchangeName, String type, String
alternateExchange,
+ Map<String, Object> arguments, Option...
options);
/**
* This method deletes an exchange. When an exchange is deleted all queue
bindings on the
@@ -600,7 +623,7 @@
*
* @param exchangeName The name of the exchange for which information is
requested. If not specified explicitly
* the default exchange is implied.
- * @result Information on the specified exchange.
+ * @return Information on the specified exchange.
*/
public Future<ExchangeQueryResult> exchangeQuery(String exchangeName);