added consistent-hash exchange (same as pull request #68)

This commit is contained in:
Emiel Bruijntjes 2016-06-15 11:20:31 -04:00
parent ec9630ced7
commit 6320e2ae0e
2 changed files with 9 additions and 5 deletions

View File

@ -24,7 +24,8 @@ enum ExchangeType
fanout,
direct,
topic,
headers
headers,
consistent_hash
};
/**

View File

@ -219,10 +219,13 @@ Deferred &ChannelImpl::declareExchange(const std::string &name, ExchangeType typ
{
// convert exchange type
std::string exchangeType;
if (type == ExchangeType::fanout) exchangeType = "fanout";
if (type == ExchangeType::direct) exchangeType = "direct";
if (type == ExchangeType::topic) exchangeType = "topic";
if (type == ExchangeType::headers)exchangeType = "headers";
// convert the exchange type into a string
if (type == ExchangeType::fanout) exchangeType = "fanout";
else if (type == ExchangeType::direct) exchangeType = "direct";
else if (type == ExchangeType::topic) exchangeType = "topic";
else if (type == ExchangeType::headers) exchangeType = "headers";
else if (type == ExchangeType::consistent_hash) exchangeType = "x-consistent-hash";
// send declare exchange frame
return push(ExchangeDeclareFrame(_id, name, exchangeType, (flags & passive) != 0, (flags & durable) != 0, false, arguments));