blob: 7be3b9c69474ce045105af416f23d178c5c0c640 [file] [log] [blame]
#pragma once
#include <string>
#include "rocketmq/ExpressionType.h"
#include "rocketmq/MQMessageExt.h"
ROCKETMQ_NAMESPACE_BEGIN
/**
* Server supported message filtering expression. At present, two types are supported: tag and SQL92.
*/
struct FilterExpression {
explicit FilterExpression(std::string expression, ExpressionType expression_type = ExpressionType::TAG)
: content_(std::move(expression)), type_(expression_type), version_(std::chrono::steady_clock::now()) {
if (ExpressionType::TAG == type_ && content_.empty()) {
content_ = WILD_CARD_TAG;
}
}
bool accept(const MQMessageExt& message) const;
std::string content_;
ExpressionType type_;
std::chrono::steady_clock::time_point version_;
static const char* WILD_CARD_TAG;
};
ROCKETMQ_NAMESPACE_END