Skip to content

[fix][client-cpp] Implement missing pulsar_message_set_schema_version in C API#552

Open
zhanglistar wants to merge 2 commits intoapache:mainfrom
bigo-sg:fix/issue-522
Open

[fix][client-cpp] Implement missing pulsar_message_set_schema_version in C API#552
zhanglistar wants to merge 2 commits intoapache:mainfrom
bigo-sg:fix/issue-522

Conversation

@zhanglistar
Copy link
Contributor

Fixes #522

Motivation

pulsar_message_set_schema_version is declared in include/pulsar/c/message.h but was never implemented. There is no delegating C function in lib/c/c_Message.cc, so linking fails when the symbol is used (e.g. when generating bindings from the C headers). This PR adds the missing implementation so the C API is complete and linkable.

Modifications

  • include/pulsar/Message.h: Declare void setSchemaVersion(const std::string& schemaVersion) on Message.
  • lib/Message.cc: Implement Message::setSchemaVersion() by setting impl_->metadata.set_schema_version(schemaVersion) so getters (getSchemaVersion / hasSchemaVersion) see the updated value.
  • lib/c/c_Message.cc: Implement pulsar_message_set_schema_version(pulsar_message_t *message, const char *schemaVersion) to call message->message.setSchemaVersion(schemaVersion ? schemaVersion : "").

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

(The new C function mirrors existing pairs like pulsar_message_get_schemaVersion / pulsar_message_has_schema_version and is a thin wrapper; existing message and C API tests continue to apply.)

Documentation

  • doc-required

  • doc-not-needed
    (C API already documents this function in the header; no separate doc update required.)

  • doc

  • doc-complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] pulsar_message_set_schema_version: Only declared but not defined?

1 participant