|
- #pragma once
-
- #include <memory>
- #include <cppamqp/enums.h>
- #include <cppamqp/types.h>
- #include <cppamqp/config.h>
- #include <cppamqp/connection.fwd.h>
- #include <cppamqp/publish_options.h>
-
- namespace cppamqp
- {
-
- struct channel
- {
- private:
- using connection_t = ::cppamqp::connection;
-
- struct internal
- {
- const connection_t& connection;
- channel_number handle;
-
- internal(const connection_t& p_connection, channel_number p_handle);
- ~internal();
- };
-
- private:
- friend struct connection;
-
- std::shared_ptr<internal> _internal;
-
- inline channel(const connection_t& p_connection, channel_number p_handle);
-
- public:
- inline channel();
- inline channel(channel&& other);
- inline ~channel();
-
- inline operator bool () const;
- inline void operator = (channel&& other);
-
- inline channel_number handle () const;
- inline const connection_t& connection () const;
-
- queue_declaration declare_queue (const std::string& name, const queue_flags& flags);
- void bind_queue (const std::string& queue, const std::string& exchange, const std::string& routing_key);
- void publish (const std::string& exchange, const std::string& routing_key, const publish_flags& flags, const std::string& message, const publish_options* options = nullptr);
- std::string consume (const std::string& queue, const std::string& consumer_tag, const consume_flags& flags);
- void qos (uint32_t prefetch_size, uint16_t prefetch_count, bool global);
- void close (int status = AMQP_REPLY_SUCCESS);
- };
-
- }
|