Browse Source

* implemented QOS method for channels

master
bergmann 5 years ago
parent
commit
9c75c30f22
2 changed files with 17 additions and 0 deletions
  1. +1
    -0
      include/cppamqp/channel.h
  2. +16
    -0
      src/cppamqp/channel.cpp

+ 1
- 0
include/cppamqp/channel.h View File

@@ -46,6 +46,7 @@ namespace cppamqp
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);
};


+ 16
- 0
src/cppamqp/channel.cpp View File

@@ -113,6 +113,22 @@ std::string channel::consume(const std::string& queue, const std::string& consum
return __impl::from_bytes(ret->consumer_tag);
}

void channel::qos(uint32_t prefetch_size, uint16_t prefetch_count, bool global)
{
auto ret = amqp_basic_qos(
connection().handle(),
handle(),
prefetch_size,
prefetch_count,
global);
__impl::check_and_raise(
amqp_get_rpc_reply(connection().handle()),
static_cast<std::ostringstream&>(std::ostringstream() << "unable to set QOS values").str(),
false);
if (!ret)
throw exception("unable to set QOS values");
}

void channel::close(int status)
{
if (!_internal)


Loading…
Cancel
Save