diff --git a/include/channel.h b/include/channel.h index e722ebb..3cfc989 100644 --- a/include/channel.h +++ b/include/channel.h @@ -331,11 +331,12 @@ public: * the prefetchCount * * @param prefetchCount maximum number of messages to prefetch + * @param global share counter between all consumers on the same channel * @return bool whether the Qos frame is sent. */ - Deferred &setQos(uint16_t prefetchCount) + Deferred &setQos(uint16_t prefetchCount, bool global = false) { - return _implementation.setQos(prefetchCount); + return _implementation.setQos(prefetchCount, global); } /** diff --git a/include/channelimpl.h b/include/channelimpl.h index 062c160..0812a9c 100644 --- a/include/channelimpl.h +++ b/include/channelimpl.h @@ -344,8 +344,11 @@ public: * * This function returns a deferred handler. Callbacks can be installed * using onSuccess(), onError() and onFinalize() methods. + * + * @param count number of messages to pre-fetch + * @param global share count between all consumers on the same channel */ - Deferred &setQos(uint16_t prefetchCount); + Deferred &setQos(uint16_t prefetchCount, bool global = false); /** * Tell the RabbitMQ server that we're ready to consume messages diff --git a/src/basicqosframe.h b/src/basicqosframe.h index 8b9c924..79e269d 100644 --- a/src/basicqosframe.h +++ b/src/basicqosframe.h @@ -55,7 +55,7 @@ public: * * @param channel channel we're working on * @param prefetchCount specifies a prefetch window in terms of whole messages - * @param global apply QoS settings to entire connection + * @param global share prefetch count with all consumers on the same channel * @default false */ BasicQosFrame(uint16_t channel, int16_t prefetchCount = 0, bool global = false) : diff --git a/src/channelimpl.cpp b/src/channelimpl.cpp index 18ceac3..1b8d256 100644 --- a/src/channelimpl.cpp +++ b/src/channelimpl.cpp @@ -462,11 +462,14 @@ bool ChannelImpl::publish(const std::string &exchange, const std::string &routin * * This function returns a deferred handler. Callbacks can be installed * using onSuccess(), onError() and onFinalize() methods. + * + * @param prefetchCount number of messages to fetch + * @param global share counter between all consumers on the same channel */ -Deferred &ChannelImpl::setQos(uint16_t prefetchCount) +Deferred &ChannelImpl::setQos(uint16_t prefetchCount, bool global) { // send a qos frame - return push(BasicQosFrame(_id, prefetchCount, false)); + return push(BasicQosFrame(_id, prefetchCount, global)); } /**