From 5f93ac7768804affcad81dca7a35546d11cc901f Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Tue, 18 Sep 2007 09:27:48 +0000 Subject: added support querying an exchange and implemented dtx Session git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@576799 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpidity/client/DtxSession.java | 8 +++++-- .../java/org/apache/qpidity/client/Session.java | 26 ++++++++++++++-------- .../apache/qpidity/client/impl/ClientSession.java | 2 +- 3 files changed, 24 insertions(+), 12 deletions(-) (limited to 'java') diff --git a/java/client/src/main/java/org/apache/qpidity/client/DtxSession.java b/java/client/src/main/java/org/apache/qpidity/client/DtxSession.java index bf6433af6a..457bb9fe7d 100644 --- a/java/client/src/main/java/org/apache/qpidity/client/DtxSession.java +++ b/java/client/src/main/java/org/apache/qpidity/client/DtxSession.java @@ -45,6 +45,7 @@ public interface DtxSession extends Session * * @param xid Specifies the xid of the transaction branch to be started. * @param options Possible options are: {@link Option#JOIN} and {@link Option#RESUME}. + * @return Confirms to the client that the transaction branch is started or specify the error condition. */ public Future dtxDemarcationStart(String xid, Option... options); @@ -62,6 +63,7 @@ public interface DtxSession extends Session * * @param xid Specifies the xid of the transaction branch to be ended. * @param options Available options are: {@link Option#FAIL} and {@link Option#SUSPEND}. + * @return Confirms to the client that the transaction branch is ended or specify the error condition. */ public Future dtxDemarcationEnd(String xid, Option... options); @@ -75,6 +77,7 @@ public interface DtxSession extends Session * * @param xid Specifies the xid of the transaction branch to be committed. * @param options Available option is: {@link Option#ONE_PHASE} + * @return Confirms to the client that the transaction branch is committed or specify the error condition. */ public Future dtxCoordinationCommit(String xid, Option... options); @@ -114,16 +117,17 @@ public interface DtxSession extends Session /** * This method is called to obtain a list of transaction branches that are in a prepared or * heuristically completed state. - * + * Todo The options ahould be removed once the xml is updated * @return a array of xids to be recovered. */ - public Future dtxCoordinationRecover(); + public Future dtxCoordinationRecover(Option... options); /** * This method rolls back the work associated with xid. Any produced messages are discarded and * any consumed messages are re-enqueued. * * @param xid Specifies the xid of the transaction branch that can be rolled back. + * @return Confirms to the client that the transaction branch is rolled back or specify the error condition. */ public Future dtxCoordinationRollback(String xid); diff --git a/java/client/src/main/java/org/apache/qpidity/client/Session.java b/java/client/src/main/java/org/apache/qpidity/client/Session.java index 2340d27882..444fb64d1b 100644 --- a/java/client/src/main/java/org/apache/qpidity/client/Session.java +++ b/java/client/src/main/java/org/apache/qpidity/client/Session.java @@ -22,9 +22,7 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.util.Map; -import org.apache.qpidity.transport.Option; -import org.apache.qpidity.transport.RangeSet; -import org.apache.qpidity.transport.Struct; +import org.apache.qpidity.transport.*; import org.apache.qpidity.api.Message; /** @@ -151,11 +149,11 @@ public interface Session /** * Declare the beginning of a message transfer operation. This operation must - * be followed by {@link Session#headers} then followed by any number of {@link Session#data}. + * be followed by {@link Session#header} then followed by any number of {@link Session#data}. * The transfer is ended by {@link Session#endData}. *

This way of transferring messages is useful when streaming large messages *

In the interval [messageTransfer endData] any attempt to call a method other than - * {@link Session#headers}, {@link Session#endData} ore {@link Session#sessionClose} + * {@link Session#header}, {@link Session#endData} ore {@link Session#sessionClose} * will result in an exception being thrown. * * @param destination The exchange the message is being sent. @@ -181,10 +179,10 @@ public interface Session /** * Add a set of headers the following headers to the message being sent. * - * @param headers Are either {@link org.apache.qpidity.DeliveryProperties} - * or {@link org.apache.qpidity.MessageProperties} - * @see org.apache.qpidity.DeliveryProperties - * @see org.apache.qpidity.MessageProperties + * @param headers Are either {@link org.apache.qpidity.transport.DeliveryProperties} + * or {@link org.apache.qpidity.transport.MessageProperties} + * @see org.apache.qpidity.transport.DeliveryProperties + * @see org.apache.qpidity.transport.MessageProperties */ public void header(Struct... headers); @@ -596,6 +594,16 @@ public interface Session */ public void exchangeDelete(String exchangeName, Option... options); + + /** + * This method is used to request information on a particular exchange. + * + * @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. + */ + public Future exchangeQuery(String exchangeName); + /** * If the session receives a sessionClosed with an error code it * informs the session's ExceptionListener diff --git a/java/client/src/main/java/org/apache/qpidity/client/impl/ClientSession.java b/java/client/src/main/java/org/apache/qpidity/client/impl/ClientSession.java index 2e53bdfcad..6d2640b8bb 100644 --- a/java/client/src/main/java/org/apache/qpidity/client/impl/ClientSession.java +++ b/java/client/src/main/java/org/apache/qpidity/client/impl/ClientSession.java @@ -16,7 +16,7 @@ import org.apache.qpidity.client.MessagePartListener; /** * Implements a Qpid Sesion. */ -public class ClientSession extends org.apache.qpidity.transport.Session implements org.apache.qpidity.client.Session +public class ClientSession extends org.apache.qpidity.transport.Session implements org.apache.qpidity.client.DtxSession { private Map _messageListeners = new HashMap(); private ExceptionListener _exceptionListner; -- cgit v1.2.1