diff options
Diffstat (limited to 'cpp/include/qpid/messaging')
-rw-r--r-- | cpp/include/qpid/messaging/Address.h | 164 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Connection.h | 114 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Duration.h | 57 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/FailoverUpdates.h | 49 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Handle.h | 71 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/ImportExport.h | 35 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Message.h | 166 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Receiver.h | 144 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Sender.h | 99 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Session.h | 175 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/exceptions.h | 153 |
11 files changed, 0 insertions, 1227 deletions
diff --git a/cpp/include/qpid/messaging/Address.h b/cpp/include/qpid/messaging/Address.h deleted file mode 100644 index 63dce0c49d..0000000000 --- a/cpp/include/qpid/messaging/Address.h +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef QPID_MESSAGING_ADDRESS_H -#define QPID_MESSAGING_ADDRESS_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/messaging/ImportExport.h" - -#include "qpid/messaging/exceptions.h" -#include "qpid/types/Variant.h" - -#include <string> -#include <ostream> - -namespace qpid { -namespace messaging { - -class AddressImpl; - -/** \ingroup messaging - * Represents an address to which messages can be sent and from which - * messages can be received. Often a simple name is sufficient for - * this, however this can be augmented with a subject pattern and - * options. - * - * All parts of an address can be specified in a string of the - * following form: - * - * <address> [ / <subject> ] ; [ { <key> : <value> , ... } ] - * - * Here the <address> is a simple name for the addressed - * entity and <subject> is a subject or subject pattern for - * messages sent to or received from this address. The options are - * specified as a series of key value pairs enclosed in curly brackets - * (denoting a map). Values can be nested maps, or lists (which are - * denoted as a comma separated list of values inside square brackets, - * e.g. [a, b, c]). - * - * The currently supported options are as follows: - * - * <table border=0> - * - * <tr valign=top> - * <td>create</td> - * <td>Indicate whether the address should be automatically created - * or not. Can be one of <i>always</i>, <i>never</i>, - * <i>sender</i> or <i>receiver</i>. The properties of the node - * to be created can be specified via the node options (see - * below). - * </td> - * </tr> - * - * <tr valign=top> - * <td>assert</td> - * <td>Indicate whether or not to assert any specified node - * properties(see below) match the address. Can be one of - * <i>always</i>, <i>never</i>, <i>sender</i> or - * <i>receiver</i>. - * </td> - * </tr> - * - * <tr valign=top> - * <td>delete</td> - * <td>Indicate whether or not to delete the addressed node when a - * sender or receiver is cancelled. Can be one of <i>always</i>, - * <i>never</i>, <i>sender</i> or <i>receiver</i>. - * </td> - * </tr> - * - * <tr valign=top> - * <td>node</td> - - * <td>A nested map describing properties of the addressed - * node. Current properties supported are type (topic or queue), - * durable (boolean), x-declare and x-bindings. The x-declare - * option is a nested map in whcih protocol amqp 0-10 specific - * options for queue or exchange declare can be specified. The - * x-bindings option is a nested list, each element of which can - * specify a queue, an exchange, a binding-key and arguments, - * which are used to establish a binding on create. The node - * will be used if queue or exchange values are not specified. - * </td> - * </tr> - * - * <tr valign=top> - * <td>link</td> - * <td>A nested map through which properties of the 'link' from - * sender/receiver to node can be configured. Current propeties - * are name, durable, realiability, x-declare, x-subscribe and - * x-bindings. - * </td> - * </tr> - * - * For receivers there is one other option of interest: - * - * <table border=0 valign=top> - * <tr valign=top><td>mode</td><td>(only relevant for queues) - * indicates whether the subscribe should consume (the default) or - * merely browse the messages. Valid values are 'consume' and - * 'browse'</td></tr> - * </table> - * - * An address has value semantics. - */ -class QPID_MESSAGING_CLASS_EXTERN Address -{ - public: - QPID_MESSAGING_EXTERN Address(); - QPID_MESSAGING_EXTERN Address(const std::string& address); - QPID_MESSAGING_EXTERN Address(const std::string& name, const std::string& subject, - const qpid::types::Variant::Map& options, const std::string& type = ""); - QPID_MESSAGING_EXTERN Address(const Address& address); - QPID_MESSAGING_EXTERN ~Address(); - QPID_MESSAGING_EXTERN Address& operator=(const Address&); - QPID_MESSAGING_EXTERN const std::string& getName() const; - QPID_MESSAGING_EXTERN void setName(const std::string&); - QPID_MESSAGING_EXTERN const std::string& getSubject() const; - QPID_MESSAGING_EXTERN void setSubject(const std::string&); - QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getOptions() const; - QPID_MESSAGING_EXTERN qpid::types::Variant::Map& getOptions(); - QPID_MESSAGING_EXTERN void setOptions(const qpid::types::Variant::Map&); - - QPID_MESSAGING_EXTERN std::string getType() const; - /** - * The type of and addressed node influences how receivers and - * senders are constructed for it. It also affects how a reply-to - * address is encoded. If the type is not specified in the address - * itself, it will be automatically determined by querying the - * broker. The type can be explicitly set to prevent this if - * needed. - */ - QPID_MESSAGING_EXTERN void setType(const std::string&); - - QPID_MESSAGING_EXTERN std::string str() const; - QPID_MESSAGING_EXTERN operator bool() const; - QPID_MESSAGING_EXTERN bool operator !() const; - private: - AddressImpl* impl; -}; - -#ifndef SWIG -QPID_MESSAGING_EXTERN std::ostream& operator<<(std::ostream& out, const Address& address); -#endif - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_ADDRESS_H*/ diff --git a/cpp/include/qpid/messaging/Connection.h b/cpp/include/qpid/messaging/Connection.h deleted file mode 100644 index e938f23189..0000000000 --- a/cpp/include/qpid/messaging/Connection.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef QPID_MESSAGING_CONNECTION_H -#define QPID_MESSAGING_CONNECTION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/messaging/ImportExport.h" - -#include "qpid/messaging/Handle.h" -#include "qpid/messaging/exceptions.h" -#include "qpid/types/Variant.h" - -#include <string> - -namespace qpid { -namespace messaging { - -#ifndef SWIG -template <class> class PrivateImplRef; -#endif -class ConnectionImpl; -class Session; - -/** \ingroup messaging - * A connection represents a network connection to a remote endpoint. - */ - -class QPID_MESSAGING_CLASS_EXTERN Connection : public qpid::messaging::Handle<ConnectionImpl> -{ - public: - QPID_MESSAGING_EXTERN Connection(ConnectionImpl* impl); - QPID_MESSAGING_EXTERN Connection(const Connection&); - QPID_MESSAGING_EXTERN Connection(); - /** - * Current implementation supports the following options: - * - * username - * password - * heartbeat - * tcp-nodelay - * sasl-mechanism - * sasl-service - * sasl-min-ssf - * sasl-max-ssf - * transport - * - * Reconnect behaviour can be controlled through the following options: - * - * reconnect: true/false (enables/disables reconnect entirely) - * reconnect-timeout: number of seconds (give up and report failure after specified time) - * reconnect-limit: n (give up and report failure after specified number of attempts) - * reconnect-interval-min: number of seconds (initial delay between failed reconnection attempts) - * reconnect-interval-max: number of seconds (maximum delay between failed reconnection attempts) - * reconnect-interval: shorthand for setting the same reconnect_interval_min/max - * reconnect-urls: list of alternate urls to try when connecting - * - * The reconnect-interval is the time that the client waits - * for after a failed attempt to reconnect before retrying. It - * starts at the value of the min-retry-interval and is - * doubled every failure until the value of max-retry-interval - * is reached. - */ - QPID_MESSAGING_EXTERN Connection(const std::string& url, const qpid::types::Variant::Map& options = qpid::types::Variant::Map()); - /** - * Creates a connection using an option string of the form - * {name:value,name2:value2...}, see above for options supported. - * - * @exception InvalidOptionString if the string does not match the correct syntax - */ - QPID_MESSAGING_EXTERN Connection(const std::string& url, const std::string& options); - QPID_MESSAGING_EXTERN ~Connection(); - QPID_MESSAGING_EXTERN Connection& operator=(const Connection&); - QPID_MESSAGING_EXTERN void setOption(const std::string& name, const qpid::types::Variant& value); - QPID_MESSAGING_EXTERN void open(); - QPID_MESSAGING_EXTERN bool isOpen(); - QPID_MESSAGING_EXTERN bool isOpen() const; - /** - * Closes a connection and all sessions associated with it. An - * opened connection must be closed before the last handle is - * allowed to go out of scope. - */ - QPID_MESSAGING_EXTERN void close(); - QPID_MESSAGING_EXTERN Session createTransactionalSession(const std::string& name = std::string()); - QPID_MESSAGING_EXTERN Session createSession(const std::string& name = std::string()); - - QPID_MESSAGING_EXTERN Session getSession(const std::string& name) const; - QPID_MESSAGING_EXTERN std::string getAuthenticatedUsername(); - -#ifndef SWIG - private: - friend class qpid::messaging::PrivateImplRef<Connection>; -#endif -}; - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_CONNECTION_H*/ diff --git a/cpp/include/qpid/messaging/Duration.h b/cpp/include/qpid/messaging/Duration.h deleted file mode 100644 index 6b8f05c7c6..0000000000 --- a/cpp/include/qpid/messaging/Duration.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef QPID_MESSAGING_DURATION_H -#define QPID_MESSAGING_DURATION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/messaging/ImportExport.h" - -#include "qpid/sys/IntegerTypes.h" - -namespace qpid { -namespace messaging { - -/** \ingroup messaging - * A duration is a time in milliseconds. - */ -class QPID_MESSAGING_CLASS_EXTERN Duration -{ - public: - QPID_MESSAGING_EXTERN explicit Duration(uint64_t milliseconds); - QPID_MESSAGING_EXTERN uint64_t getMilliseconds() const; - QPID_MESSAGING_EXTERN static const Duration FOREVER; - QPID_MESSAGING_EXTERN static const Duration IMMEDIATE; - QPID_MESSAGING_EXTERN static const Duration SECOND; - QPID_MESSAGING_EXTERN static const Duration MINUTE; - private: - uint64_t milliseconds; -}; - -QPID_MESSAGING_EXTERN Duration operator*(const Duration& duration, - uint64_t multiplier); -QPID_MESSAGING_EXTERN Duration operator*(uint64_t multiplier, - const Duration& duration); -QPID_MESSAGING_EXTERN bool operator==(const Duration& a, const Duration& b); -QPID_MESSAGING_EXTERN bool operator!=(const Duration& a, const Duration& b); - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_DURATION_H*/ diff --git a/cpp/include/qpid/messaging/FailoverUpdates.h b/cpp/include/qpid/messaging/FailoverUpdates.h deleted file mode 100644 index 6d7314620a..0000000000 --- a/cpp/include/qpid/messaging/FailoverUpdates.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef QPID_CLIENT_AMQP0_10_FAILOVERUPDATES_H -#define QPID_CLIENT_AMQP0_10_FAILOVERUPDATES_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/messaging/ImportExport.h" - -namespace qpid { -namespace messaging { -class Connection; -struct FailoverUpdatesImpl; - -/** - * A utility to listen for updates on cluster membership and update - * the list of known urls for a connection accordingly. - */ -class QPID_MESSAGING_CLASS_EXTERN FailoverUpdates -{ - public: - QPID_MESSAGING_EXTERN FailoverUpdates(Connection& connection); - QPID_MESSAGING_EXTERN ~FailoverUpdates(); - private: - FailoverUpdatesImpl* impl; - - //no need to copy instances of this class - FailoverUpdates(const FailoverUpdates&); - FailoverUpdates& operator=(const FailoverUpdates&); -}; -}} // namespace qpid::messaging - -#endif /*!QPID_CLIENT_AMQP0_10_FAILOVERUPDATES_H*/ diff --git a/cpp/include/qpid/messaging/Handle.h b/cpp/include/qpid/messaging/Handle.h deleted file mode 100644 index 97a8f00b54..0000000000 --- a/cpp/include/qpid/messaging/Handle.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef QPID_MESSAGING_HANDLE_H -#define QPID_MESSAGING_HANDLE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/messaging/ImportExport.h" - -namespace qpid { -namespace messaging { - -template <class> class PrivateImplRef; - -/** \ingroup messaging - * A handle is like a pointer: refers to an underlying implementation object. - * Copying the handle does not copy the object. - * - * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the - * conversion to bool to test for a null handle. - */ -template <class T> class Handle { - public: - - /**@return true if handle is valid, i.e. not null. */ - QPID_MESSAGING_INLINE_EXTERN bool isValid() const { return impl; } - - /**@return true if handle is null. It is an error to call any function on a null handle. */ - QPID_MESSAGING_INLINE_EXTERN bool isNull() const { return !impl; } - - /** Conversion to bool supports idiom if (handle) { handle->... } */ - QPID_MESSAGING_INLINE_EXTERN operator bool() const { return impl; } - - /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */ - QPID_MESSAGING_INLINE_EXTERN bool operator !() const { return !impl; } - - void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; } - - protected: - typedef T Impl; - QPID_MESSAGING_INLINE_EXTERN Handle() :impl() {} - - // Not implemented,subclasses must implement. - QPID_MESSAGING_EXTERN Handle(const Handle&); - QPID_MESSAGING_EXTERN Handle& operator=(const Handle&); - - Impl* impl; - - friend class PrivateImplRef<T>; -}; - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_HANDLE_H*/ diff --git a/cpp/include/qpid/messaging/ImportExport.h b/cpp/include/qpid/messaging/ImportExport.h deleted file mode 100644 index ab5f21f618..0000000000 --- a/cpp/include/qpid/messaging/ImportExport.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef QPID_MESSAGING_IMPORTEXPORT_H -#define QPID_MESSAGING_IMPORTEXPORT_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include "qpid/ImportExport.h" - -#if defined(CLIENT_EXPORT) || defined (qpidmessaging_EXPORTS) -# define QPID_MESSAGING_EXTERN QPID_EXPORT -# define QPID_MESSAGING_CLASS_EXTERN QPID_CLASS_EXPORT -# define QPID_MESSAGING_INLINE_EXTERN QPID_INLINE_EXPORT -#else -# define QPID_MESSAGING_EXTERN QPID_IMPORT -# define QPID_MESSAGING_CLASS_EXTERN QPID_CLASS_IMPORT -# define QPID_MESSAGING_INLINE_EXTERN QPID_INLINE_IMPORT -#endif - -#endif /*!QPID_MESSAGING_IMPORTEXPORT_H*/ diff --git a/cpp/include/qpid/messaging/Message.h b/cpp/include/qpid/messaging/Message.h deleted file mode 100644 index 5cd978f2a2..0000000000 --- a/cpp/include/qpid/messaging/Message.h +++ /dev/null @@ -1,166 +0,0 @@ -#ifndef QPID_MESSAGING_MESSAGE_H -#define QPID_MESSAGING_MESSAGE_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/messaging/ImportExport.h" - -#include "qpid/messaging/Duration.h" -#include "qpid/types/Exception.h" -#include "qpid/types/Variant.h" - -#include <string> - -namespace qpid { -namespace messaging { - -class Address; -class Codec; -struct MessageImpl; - -/** \ingroup messaging - * Representation of a message. - */ -class QPID_MESSAGING_CLASS_EXTERN Message -{ - public: - QPID_MESSAGING_EXTERN Message(const std::string& bytes = std::string()); - QPID_MESSAGING_EXTERN Message(const char*, size_t); - QPID_MESSAGING_EXTERN Message(const Message&); - QPID_MESSAGING_EXTERN ~Message(); - - QPID_MESSAGING_EXTERN Message& operator=(const Message&); - - QPID_MESSAGING_EXTERN void setReplyTo(const Address&); - QPID_MESSAGING_EXTERN const Address& getReplyTo() const; - - QPID_MESSAGING_EXTERN void setSubject(const std::string&); - QPID_MESSAGING_EXTERN const std::string& getSubject() const; - - QPID_MESSAGING_EXTERN void setContentType(const std::string&); - QPID_MESSAGING_EXTERN const std::string& getContentType() const; - - QPID_MESSAGING_EXTERN void setMessageId(const std::string&); - QPID_MESSAGING_EXTERN const std::string& getMessageId() const; - - QPID_MESSAGING_EXTERN void setUserId(const std::string&); - QPID_MESSAGING_EXTERN const std::string& getUserId() const; - - QPID_MESSAGING_EXTERN void setCorrelationId(const std::string&); - QPID_MESSAGING_EXTERN const std::string& getCorrelationId() const; - - QPID_MESSAGING_EXTERN void setPriority(uint8_t); - QPID_MESSAGING_EXTERN uint8_t getPriority() const; - - /** - * Set the time to live for this message in milliseconds. - */ - QPID_MESSAGING_EXTERN void setTtl(Duration ttl); - /** - *Get the time to live for this message in milliseconds. - */ - QPID_MESSAGING_EXTERN Duration getTtl() const; - - QPID_MESSAGING_EXTERN void setDurable(bool durable); - QPID_MESSAGING_EXTERN bool getDurable() const; - - QPID_MESSAGING_EXTERN bool getRedelivered() const; - QPID_MESSAGING_EXTERN void setRedelivered(bool); - - QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getProperties() const; - QPID_MESSAGING_EXTERN qpid::types::Variant::Map& getProperties(); - - QPID_MESSAGING_EXTERN void setContent(const std::string&); - /** - * Note that chars are copied. - */ - QPID_MESSAGING_EXTERN void setContent(const char* chars, size_t count); - - /** Get the content as a std::string */ - QPID_MESSAGING_EXTERN std::string getContent() const; - /** Get a const pointer to the start of the content data. */ - QPID_MESSAGING_EXTERN const char* getContentPtr() const; - /** Get the size of content in bytes. */ - QPID_MESSAGING_EXTERN size_t getContentSize() const; - - QPID_MESSAGING_EXTERN void setProperty(const std::string&, const qpid::types::Variant&); - private: - MessageImpl* impl; - friend struct MessageImplAccess; -}; - -struct QPID_MESSAGING_CLASS_EXTERN EncodingException : qpid::types::Exception -{ - QPID_MESSAGING_EXTERN EncodingException(const std::string& msg); -}; - -/** - * Decodes message content into a Variant::Map. - * - * @param message the message whose content should be decoded - * @param map the map into which the message contents will be decoded - * @param encoding if specified, the encoding to use - this overrides - * any encoding specified by the content-type of the message - * @exception EncodingException - */ -QPID_MESSAGING_EXTERN void decode(const Message& message, - qpid::types::Variant::Map& map, - const std::string& encoding = std::string()); -/** - * Decodes message content into a Variant::List. - * - * @param message the message whose content should be decoded - * @param list the list into which the message contents will be decoded - * @param encoding if specified, the encoding to use - this overrides - * any encoding specified by the content-type of the message - * @exception EncodingException - */ -QPID_MESSAGING_EXTERN void decode(const Message& message, - qpid::types::Variant::List& list, - const std::string& encoding = std::string()); -/** - * Encodes a Variant::Map into a message. - * - * @param map the map to be encoded - * @param message the message whose content should be set to the encoded map - * @param encoding if specified, the encoding to use - this overrides - * any encoding specified by the content-type of the message - * @exception EncodingException - */ -QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::Map& map, - Message& message, - const std::string& encoding = std::string()); -/** - * Encodes a Variant::List into a message. - * - * @param list the list to be encoded - * @param message the message whose content should be set to the encoded list - * @param encoding if specified, the encoding to use - this overrides - * any encoding specified by the content-type of the message - * @exception EncodingException - */ -QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::List& list, - Message& message, - const std::string& encoding = std::string()); - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_MESSAGE_H*/ diff --git a/cpp/include/qpid/messaging/Receiver.h b/cpp/include/qpid/messaging/Receiver.h deleted file mode 100644 index 13317dfcbd..0000000000 --- a/cpp/include/qpid/messaging/Receiver.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef QPID_MESSAGING_RECEIVER_H -#define QPID_MESSAGING_RECEIVER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/messaging/ImportExport.h" - -#include "qpid/messaging/exceptions.h" -#include "qpid/messaging/Handle.h" -#include "qpid/messaging/Duration.h" - -namespace qpid { -namespace messaging { - -#ifndef SWIG -template <class> class PrivateImplRef; -#endif - -class Message; -class ReceiverImpl; -class Session; - -/** \ingroup messaging - * Interface through which messages are received. - */ -class QPID_MESSAGING_CLASS_EXTERN Receiver : public qpid::messaging::Handle<ReceiverImpl> -{ - public: - QPID_MESSAGING_EXTERN Receiver(ReceiverImpl* impl = 0); - QPID_MESSAGING_EXTERN Receiver(const Receiver&); - QPID_MESSAGING_EXTERN ~Receiver(); - QPID_MESSAGING_EXTERN Receiver& operator=(const Receiver&); - /** - * Retrieves a message from this receivers local queue, or waits - * for upto the specified timeout for a message to become - * available. - */ - QPID_MESSAGING_EXTERN bool get(Message& message, Duration timeout=Duration::FOREVER); - /** - * Retrieves a message from this receivers local queue, or waits - * for up to the specified timeout for a message to become - * available. - * - * @exception NoMessageAvailable if there is no message to give - * after waiting for the specified timeout, or if the Receiver is - * closed, in which case isClose() will be true. - */ - QPID_MESSAGING_EXTERN Message get(Duration timeout=Duration::FOREVER); - /** - * Retrieves a message for this receivers subscription or waits - * for up to the specified timeout for one to become - * available. Unlike get() this method will check with the server - * that there is no message for the subscription this receiver is - * serving before returning false. - * - * @return false if there is no message to give after - * waiting for the specified timeout, or if the Receiver is - * closed, in which case isClose() will be true. - */ - QPID_MESSAGING_EXTERN bool fetch(Message& message, Duration timeout=Duration::FOREVER); - /** - * Retrieves a message for this receivers subscription or waits - * for up to the specified timeout for one to become - * available. Unlike get() this method will check with the server - * that there is no message for the subscription this receiver is - * serving before throwing an exception. - * - * @exception NoMessageAvailable if there is no message to give - * after waiting for the specified timeout, or if the Receiver is - * closed, in which case isClose() will be true. - */ - QPID_MESSAGING_EXTERN Message fetch(Duration timeout=Duration::FOREVER); - /** - * Sets the capacity for the receiver. The capacity determines how - * many incoming messages can be held in the receiver before being - * requested by a client via fetch() (or pushed to a listener). - */ - QPID_MESSAGING_EXTERN void setCapacity(uint32_t); - /** - * @return the capacity of the receiver. The capacity determines - * how many incoming messages can be held in the receiver before - * being requested by a client via fetch() (or pushed to a - * listener). - */ - QPID_MESSAGING_EXTERN uint32_t getCapacity(); - /** - * @return the number of messages received and waiting to be - * fetched. - */ - QPID_MESSAGING_EXTERN uint32_t getAvailable(); - /** - * @return a count of the number of messages received on this - * receiver that have been acknowledged, but for which that - * acknowledgement has not yet been confirmed as processed by the - * server. - */ - QPID_MESSAGING_EXTERN uint32_t getUnsettled(); - - /** - * Cancels this receiver. - */ - QPID_MESSAGING_EXTERN void close(); - - /** - * Return true if the receiver was closed by a call to close() - */ - QPID_MESSAGING_EXTERN bool isClosed() const; - - /** - * Returns the name of this receiver. - */ - QPID_MESSAGING_EXTERN const std::string& getName() const; - - /** - * Returns a handle to the session associated with this receiver. - */ - QPID_MESSAGING_EXTERN Session getSession() const; - -#ifndef SWIG - private: - friend class qpid::messaging::PrivateImplRef<Receiver>; -#endif -}; -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_RECEIVER_H*/ diff --git a/cpp/include/qpid/messaging/Sender.h b/cpp/include/qpid/messaging/Sender.h deleted file mode 100644 index 8e1c5846e9..0000000000 --- a/cpp/include/qpid/messaging/Sender.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef QPID_MESSAGING_SENDER_H -#define QPID_MESSAGING_SENDER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/messaging/ImportExport.h" - -#include "qpid/messaging/Handle.h" -#include "qpid/sys/IntegerTypes.h" - -#include <string> - -namespace qpid { -namespace messaging { - -#ifndef SWIG -template <class> class PrivateImplRef; -#endif -class Message; -class SenderImpl; -class Session; -/** \ingroup messaging - * Interface through which messages are sent. - */ -class QPID_MESSAGING_CLASS_EXTERN Sender : public qpid::messaging::Handle<SenderImpl> -{ - public: - QPID_MESSAGING_EXTERN Sender(SenderImpl* impl = 0); - QPID_MESSAGING_EXTERN Sender(const Sender&); - QPID_MESSAGING_EXTERN ~Sender(); - QPID_MESSAGING_EXTERN Sender& operator=(const Sender&); - - /** - * Sends a message - * - * @param message the message to send - * @param sync if true the call will block until the server - * confirms receipt of the messages; if false will only block for - * available capacity (i.e. pending == capacity) - */ - QPID_MESSAGING_EXTERN void send(const Message& message, bool sync=false); - QPID_MESSAGING_EXTERN void close(); - - /** - * Sets the capacity for the sender. The capacity determines how - * many outgoing messages can be held pending confirmation of - * receipt by the broker. - */ - QPID_MESSAGING_EXTERN void setCapacity(uint32_t); - /** - * Returns the capacity of the sender. - * @see setCapacity - */ - QPID_MESSAGING_EXTERN uint32_t getCapacity(); - /** - * Returns the number of sent messages pending confirmation of - * receipt by the broker. (These are the 'in-doubt' messages). - */ - QPID_MESSAGING_EXTERN uint32_t getUnsettled(); - /** - * Returns the number of messages for which there is available - * capacity. - */ - QPID_MESSAGING_EXTERN uint32_t getAvailable(); - /** - * Returns the name of this sender. - */ - QPID_MESSAGING_EXTERN const std::string& getName() const; - - /** - * Returns a handle to the session associated with this sender. - */ - QPID_MESSAGING_EXTERN Session getSession() const; -#ifndef SWIG - private: - friend class qpid::messaging::PrivateImplRef<Sender>; -#endif -}; -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_SENDER_H*/ diff --git a/cpp/include/qpid/messaging/Session.h b/cpp/include/qpid/messaging/Session.h deleted file mode 100644 index 52786eb5f4..0000000000 --- a/cpp/include/qpid/messaging/Session.h +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef QPID_MESSAGING_SESSION_H -#define QPID_MESSAGING_SESSION_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/messaging/ImportExport.h" - -#include "qpid/messaging/exceptions.h" -#include "qpid/messaging/Duration.h" -#include "qpid/messaging/Handle.h" - -#include <string> - -namespace qpid { -namespace messaging { - -#ifndef SWIG -template <class> class PrivateImplRef; -#endif -class Address; -class Connection; -class Message; -class Sender; -class Receiver; -class SessionImpl; - -/** \ingroup messaging - * A session represents a distinct 'conversation' which can involve - * sending and receiving messages to and from different addresses. - */ -class QPID_MESSAGING_CLASS_EXTERN Session : public qpid::messaging::Handle<SessionImpl> -{ - public: - QPID_MESSAGING_EXTERN Session(SessionImpl* impl = 0); - QPID_MESSAGING_EXTERN Session(const Session&); - QPID_MESSAGING_EXTERN ~Session(); - QPID_MESSAGING_EXTERN Session& operator=(const Session&); - - /** - * Closes a session and all associated senders and receivers. An - * opened session should be closed before the last handle to it - * goes out of scope. All a connections sessions can be closed by - * a call to Connection::close(). - */ - QPID_MESSAGING_EXTERN void close(); - - QPID_MESSAGING_EXTERN void commit(); - QPID_MESSAGING_EXTERN void rollback(); - - /** - * Acknowledges all outstanding messages that have been received - * by the application on this session. - * - * @param sync if true, blocks until the acknowledgement has been - * processed by the server - */ - QPID_MESSAGING_EXTERN void acknowledge(bool sync=false); - /** - * Acknowledges the specified message. - */ - QPID_MESSAGING_EXTERN void acknowledge(Message&, bool sync=false); - /** - * Rejects the specified message. The broker does not redeliver a - * message that has been rejected. Once a message has been - * acknowledged, it can no longer be rejected. - */ - QPID_MESSAGING_EXTERN void reject(Message&); - /** - * Releases the specified message. The broker may redeliver the - * message. One a message has been acknowledged, it can no longer - * be released. - */ - QPID_MESSAGING_EXTERN void release(Message&); - - /** - * Request synchronisation with the server. - * - * @param block if true, this call will block until the server - * confirms completion of all pending operations; if false the - * call will request notification from the server but will return - * before receiving it. - */ - QPID_MESSAGING_EXTERN void sync(bool block=true); - - /** - * Returns the total number of messages received and waiting to be - * fetched by all Receivers belonging to this session. This is the - * total number of available messages across all receivers on this - * session. - */ - QPID_MESSAGING_EXTERN uint32_t getReceivable(); - /** - * Returns a count of the number of messages received this session - * that have been acknowledged, but for which that acknowledgement - * has not yet been confirmed as processed by the server. - */ - QPID_MESSAGING_EXTERN uint32_t getUnsettledAcks(); - /** - * Retrieves the receiver for the next available message. If there - * are no available messages at present the call will block for up - * to the specified timeout waiting for one to arrive. Returns - * true if a message was available at the point of return, in - * which case the passed in receiver reference will be set to the - * receiver for that message or false if no message was available. - */ - QPID_MESSAGING_EXTERN bool nextReceiver(Receiver&, Duration timeout=Duration::FOREVER); - /** - * Returns the receiver for the next available message. If there - * are no available messages at present the call will block for up - * to the specified timeout waiting for one to arrive. - * - * @exception Receiver::NoMessageAvailable if no message became - * available in time. - */ - QPID_MESSAGING_EXTERN Receiver nextReceiver(Duration timeout=Duration::FOREVER); - - /** - * Create a new sender through which messages can be sent to the - * specified address. - */ - QPID_MESSAGING_EXTERN Sender createSender(const Address& address); - QPID_MESSAGING_EXTERN Sender createSender(const std::string& address); - - /** - * Create a new receiver through which messages can be received - * from the specified address. - */ - QPID_MESSAGING_EXTERN Receiver createReceiver(const Address& address); - QPID_MESSAGING_EXTERN Receiver createReceiver(const std::string& address); - - /** - * Returns the sender with the specified name. - *@exception KeyError if there is none for that name. - */ - QPID_MESSAGING_EXTERN Sender getSender(const std::string& name) const; - /** - * Returns the receiver with the specified name. - *@exception KeyError if there is none for that name. - */ - QPID_MESSAGING_EXTERN Receiver getReceiver(const std::string& name) const; - /** - * Returns a handle to the connection this session is associated - * with. - */ - QPID_MESSAGING_EXTERN Connection getConnection() const; - - QPID_MESSAGING_EXTERN bool hasError(); - QPID_MESSAGING_EXTERN void checkError(); - -#ifndef SWIG - private: - friend class qpid::messaging::PrivateImplRef<Session>; -#endif -}; -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_SESSION_H*/ diff --git a/cpp/include/qpid/messaging/exceptions.h b/cpp/include/qpid/messaging/exceptions.h deleted file mode 100644 index 07d1dc414b..0000000000 --- a/cpp/include/qpid/messaging/exceptions.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef QPID_MESSAGING_EXCEPTIONS_H -#define QPID_MESSAGING_EXCEPTIONS_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/messaging/ImportExport.h" -#include "qpid/types/Exception.h" -#include "qpid/types/Variant.h" - -namespace qpid { -namespace messaging { - -/** \ingroup messaging - */ - -struct QPID_MESSAGING_CLASS_EXTERN MessagingException : public qpid::types::Exception -{ - QPID_MESSAGING_EXTERN MessagingException(const std::string& msg); - QPID_MESSAGING_EXTERN virtual ~MessagingException() throw(); - - qpid::types::Variant::Map detail; - //TODO: override what() to include detail if present -}; - -struct QPID_MESSAGING_CLASS_EXTERN InvalidOptionString : public MessagingException -{ - QPID_MESSAGING_EXTERN InvalidOptionString(const std::string& msg); -}; - -struct QPID_MESSAGING_CLASS_EXTERN KeyError : public MessagingException -{ - QPID_MESSAGING_EXTERN KeyError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN LinkError : public MessagingException -{ - QPID_MESSAGING_EXTERN LinkError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN AddressError : public LinkError -{ - QPID_MESSAGING_EXTERN AddressError(const std::string&); -}; - -/** - * Thrown when a syntactically correct address cannot be resolved or - * used. - */ -struct QPID_MESSAGING_CLASS_EXTERN ResolutionError : public AddressError -{ - QPID_MESSAGING_EXTERN ResolutionError(const std::string& msg); -}; - -struct QPID_MESSAGING_CLASS_EXTERN AssertionFailed : public ResolutionError -{ - QPID_MESSAGING_EXTERN AssertionFailed(const std::string& msg); -}; - -struct QPID_MESSAGING_CLASS_EXTERN NotFound : public ResolutionError -{ - QPID_MESSAGING_EXTERN NotFound(const std::string& msg); -}; - -/** - * Thrown when an address string with inalid sytanx is used. - */ -struct QPID_MESSAGING_CLASS_EXTERN MalformedAddress : public AddressError -{ - QPID_MESSAGING_EXTERN MalformedAddress(const std::string& msg); -}; - -struct QPID_MESSAGING_CLASS_EXTERN ReceiverError : public LinkError -{ - QPID_MESSAGING_EXTERN ReceiverError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN FetchError : public ReceiverError -{ - QPID_MESSAGING_EXTERN FetchError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN NoMessageAvailable : public FetchError -{ - QPID_MESSAGING_EXTERN NoMessageAvailable(); -}; - -struct QPID_MESSAGING_CLASS_EXTERN SenderError : public LinkError -{ - QPID_MESSAGING_EXTERN SenderError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN SendError : public SenderError -{ - QPID_MESSAGING_EXTERN SendError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN TargetCapacityExceeded : public SendError -{ - QPID_MESSAGING_EXTERN TargetCapacityExceeded(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN SessionError : public MessagingException -{ - QPID_MESSAGING_EXTERN SessionError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN TransactionError : public SessionError -{ - QPID_MESSAGING_EXTERN TransactionError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN TransactionAborted : public TransactionError -{ - QPID_MESSAGING_EXTERN TransactionAborted(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN UnauthorizedAccess : public SessionError -{ - QPID_MESSAGING_EXTERN UnauthorizedAccess(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN ConnectionError : public MessagingException -{ - QPID_MESSAGING_EXTERN ConnectionError(const std::string&); -}; - -struct QPID_MESSAGING_CLASS_EXTERN TransportFailure : public MessagingException -{ - QPID_MESSAGING_EXTERN TransportFailure(const std::string&); -}; - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_EXCEPTIONS_H*/ |