Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/pulsar/Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ class PULSAR_PUBLIC Message {
*/
const std::string& getSchemaVersion() const;

/**
* Set the schema version of the message.
*/
void setSchemaVersion(const std::string& schemaVersion);

/**
* Get the producer name which produced this message.
*
Expand Down
6 changes: 6 additions & 0 deletions lib/Message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ const std::string& Message::getSchemaVersion() const {
return impl_->getSchemaVersion();
}

void Message::setSchemaVersion(const std::string& schemaVersion) {
if (impl_) {
impl_->metadata.set_schema_version(schemaVersion);
}
}

uint64_t Message::getPublishTimestamp() const { return impl_ ? impl_->getPublishTimestamp() : 0ull; }

uint64_t Message::getEventTimestamp() const { return impl_ ? impl_->getEventTimestamp() : 0ull; }
Expand Down
4 changes: 3 additions & 1 deletion lib/RetryableLookupService.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
#pragma once

#include <string>

#include "LookupDataResult.h"
#include "LookupService.h"
#include "NamespaceName.h"
Expand Down Expand Up @@ -64,7 +66,7 @@ class RetryableLookupService : public LookupService {
Future<Result, NamespaceTopicsPtr> getTopicsOfNamespaceAsync(
const NamespaceNamePtr& nsName, CommandGetTopicsOfNamespace_Mode mode) override {
return namespaceLookupCache_->run(
"get-topics-of-namespace-" + nsName->toString(),
"get-topics-of-namespace-" + nsName->toString() + "-" + std::to_string(mode),
[this, nsName, mode] { return lookupService_->getTopicsOfNamespaceAsync(nsName, mode); });
}

Expand Down
4 changes: 4 additions & 0 deletions lib/c/c_Message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ int pulsar_message_has_schema_version(pulsar_message_t *message) {
return message->message.hasSchemaVersion();
}

void pulsar_message_set_schema_version(pulsar_message_t *message, const char *schemaVersion) {
message->message.setSchemaVersion(schemaVersion ? schemaVersion : "");
}

const char *pulsar_message_get_producer_name(pulsar_message_t *message) {
return message->message.getProducerName().c_str();
}
Loading