pulsar-client-cpp
Loading...
Searching...
No Matches
MessageRoutingPolicy.h
1
19#ifndef PULSAR_MESSAGE_ROUTING_POLICY_HEADER_
20#define PULSAR_MESSAGE_ROUTING_POLICY_HEADER_
21
22#include <pulsar/DeprecatedException.h>
23#include <pulsar/Message.h>
24#include <pulsar/TopicMetadata.h>
25#include <pulsar/defines.h>
26
27#include <memory>
28
29/*
30 * Implement this interface to define custom policy giving message to
31 * partition mapping.
32 */
33namespace pulsar {
34
35class PULSAR_PUBLIC MessageRoutingPolicy {
36 public:
37 virtual ~MessageRoutingPolicy() {}
38
42 virtual int getPartition(const Message& msg) {
44 "Use int getPartition(const Message& msg,"
45 " const TopicMetadata& topicMetadata)");
46 }
47
55 virtual int getPartition(const Message& msg, const TopicMetadata& topicMetadata) {
56 return getPartition(msg);
57 }
58};
59
60typedef std::shared_ptr<MessageRoutingPolicy> MessageRoutingPolicyPtr;
61} // namespace pulsar
62
63#endif // PULSAR_MESSAGE_ROUTING_POLICY_HEADER_
Definition DeprecatedException.h:28
Definition Message.h:44
Definition MessageRoutingPolicy.h:35
virtual int getPartition(const Message &msg, const TopicMetadata &topicMetadata)
Definition MessageRoutingPolicy.h:55
virtual int getPartition(const Message &msg)
Definition MessageRoutingPolicy.h:42
Definition TopicMetadata.h:28
Definition Authentication.h:31