summaryrefslogtreecommitdiff
path: root/qpid/cpp/include
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2015-02-27 16:37:06 +0000
committerAlan Conway <aconway@apache.org>2015-02-27 16:37:06 +0000
commit3aaa53e9103b6019c9e31d15186b12a95a1993be (patch)
treef5950c063ff08f574c808023ece7745739ca7027 /qpid/cpp/include
parent9c9f0e2c935d11c0f8d1ebddf1bbb78c3c22c606 (diff)
downloadqpid-python-3aaa53e9103b6019c9e31d15186b12a95a1993be.tar.gz
QPID-4710: [AMQP 1.0] Support for transactions in qpid::messaging C++ client.
Implements the "transactional retire and settle immediately" option for transactions as specified in AMQP 1.0 in the qpid::messaging C++ client. NOTE: Transactions over AMQP 1.0 require proton 0.9 or greater. With older versions, attempting a transactions over AMQP 1.0 will raise a link-detached exception "Node not found: tx-transaction" 1. Added descriptor list to Variant with support in Encoder and PnData. Required to support transactions, need to be able to create described lists. Variant changes are source and binary compatible. A Variant now has a Variant::List of descripors which can be numeric or string. Nested descriptors are implemented by putting multiple descriptors in the list. Other minor changes: - Variant refactor: don't delete impl on every assignment. - Add Variant constructors that take a string encoding. (new constructors, not defaulted arguments, so the change is binary and source compatible.) - Growable buffer support for Encoder. - Printing described Variant prints descriptors in form @descriptor value 2. Added transaction support to AMQP 1.0 client code Added messaging/amqp/Transaction.h,cpp: transaction logic - communicate with coordinator, send declare/dischange messages. - add tx state info to transfers and acknowledgements. - Sync session after discharge. - A transactional session automatically acks any message retrieved by fetch/get to bring them into the transaction. This is consistent the 0-10 client. Minor fixes to existing client code: - Fix use of pn_drain API in C++ client to work with C++ and Java brokers. - Make amqp::Exception derive from qpid::Exception 3. Fixes to existing broker code: - Incoming.cpp fix: start async completion before processing message. - Delay accept of dischage message till commit is complete. - newSession - handle failover during session creation. 4. Added tests interop_tests.py: transaction tests that can run against an external broker, see comments. ha_tests.py: Enable transaction tests over AMQP 1.0. Minor test fixes: - brokertest.py don't set default logging if QPID_LOG env vars set. - brokertest.py Pass kwargs to broker() create function. - qpid-receive: capacity should never be larger than message count. - Accept user:pass as well as user/pass in Url. - brokertest.py: Always do a ready() check on all brokers. If proton < 0.9 is used, transaction tests will be skipped or will downgrade to the amqp0-10 protocol with a printed warning. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1662743 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
-rw-r--r--qpid/cpp/include/qpid/types/Variant.h45
1 files changed, 42 insertions, 3 deletions
diff --git a/qpid/cpp/include/qpid/types/Variant.h b/qpid/cpp/include/qpid/types/Variant.h
index faba5fe9a4..843870e438 100644
--- a/qpid/cpp/include/qpid/types/Variant.h
+++ b/qpid/cpp/include/qpid/types/Variant.h
@@ -89,7 +89,9 @@ class QPID_TYPES_CLASS_EXTERN Variant
QPID_TYPES_EXTERN Variant(float);
QPID_TYPES_EXTERN Variant(double);
QPID_TYPES_EXTERN Variant(const std::string&);
+ QPID_TYPES_EXTERN Variant(const std::string& value, const std::string& encoding);
QPID_TYPES_EXTERN Variant(const char*);
+ QPID_TYPES_EXTERN Variant(const char* value, const char* encoding);
QPID_TYPES_EXTERN Variant(const Map&);
QPID_TYPES_EXTERN Variant(const List&);
QPID_TYPES_EXTERN Variant(const Variant&);
@@ -156,9 +158,10 @@ class QPID_TYPES_CLASS_EXTERN Variant
QPID_TYPES_EXTERN Map& asMap();
QPID_TYPES_EXTERN const List& asList() const;
QPID_TYPES_EXTERN List& asList();
+
/**
- * Unlike asString(), getString() will not do any conversions and
- * will throw InvalidConversion if the type is not STRING.
+ * Unlike asString(), getString() will not do any conversions.
+ * @exception InvalidConversion if the type is not STRING.
*/
QPID_TYPES_EXTERN const std::string& getString() const;
QPID_TYPES_EXTERN std::string& getString();
@@ -168,9 +171,45 @@ class QPID_TYPES_CLASS_EXTERN Variant
QPID_TYPES_EXTERN bool isEqualTo(const Variant& a) const;
+ /** Reset value to VOID, does not reset the descriptors. */
QPID_TYPES_EXTERN void reset();
+
+ /** True if there is at least one descriptor associated with this variant. */
+ QPID_TYPES_EXTERN bool isDescribed() const;
+
+ /** Get the first descriptor associated with this variant.
+ *
+ * Normally there is at most one descriptor, when there are multiple
+ * descriptors use getDescriptors()
+ *
+ *@return The first descriptor or VOID if there is no descriptor.
+ *@see isDescribed, getDescriptors
+ */
+ QPID_TYPES_EXTERN Variant getDescriptor() const;
+
+ /** Set a single descriptor for this Variant. The descriptor must be a string or integer. */
+ QPID_TYPES_EXTERN void setDescriptor(const Variant& descriptor);
+
+ /** Return a modifiable list of descriptors for this Variant.
+ * Used in case where there are multiple descriptors, for a single descriptor use
+ * getDescriptor and setDescriptor.
+ */
+ QPID_TYPES_EXTERN List& getDescriptors();
+
+ /** Return the list of descriptors for this Variant.
+ * Used in case where there are multiple descriptors, for a single descriptor use
+ * getDescriptor and setDescriptor.
+ */
+ QPID_TYPES_EXTERN const List& getDescriptors() const;
+
+ /** Create a described value */
+ QPID_TYPES_EXTERN static Variant described(const Variant& descriptor, const Variant& value);
+
+ /** Create a described list, a common special case */
+ QPID_TYPES_EXTERN static Variant described(const Variant& descriptor, const List& value);
+
private:
- VariantImpl* impl;
+ mutable VariantImpl* impl;
};
#ifndef SWIG