rabbitmq设置消息ttl和优先级无效

qq_29648277 2019-06-04 02:45:24
for(int i=1; i<10; i++)
{
string sendmessage = message + std::to_string(i);
amqp_bytes_t_ cc1 = amqp_bytes_malloc(sendmessage.length());
memcpy(cc1.bytes, sendmessage.c_str(),sendmessage.length() );
amqp_basic_properties_t_ properties;
properties.priority = i; // 优先级
string strtime = "1";
properties.expiration = amqp_bytes_malloc(strtime.length()); // TTL
memcpy(properties.expiration.bytes, strtime.c_str(), strtime.length());
properties.expiration.len = strtime.length();
AmqpClient::BasicMessage::ptr_t my =AmqpClient::BasicMessage::Create(cc1, &properties);
channel->BasicPublish("", queue_name, my);
}
...全文
440 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_29648277 2019-06-04
  • 打赏
  • 举报
回复
qq_29648277 2019-06-04
  • 打赏
  • 举报
回复
qq_29648277 2019-06-04
  • 打赏
  • 举报
回复
设置完优先级和ttl后,消费者仍按照顺序执行,且超出时间消息后不会消失

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧