GitHub user djcohen03 closed a discussion: Is there a way to set the topic compaction key using the Python pulsar client?
Pulsar's topic compaction is a powerful feature, which requires that you set a "key", which Pulsar uses to perform the compaction. However, based on my understanding (and a bit of tinkering/guess-and-check), it does not seem like the python client provides an interface for specifying the compaction key on an outbound message. The two primary sending interfaces are the `send` and `send_async` methods, as defined in the source code here: [send](https://github.com/apache/pulsar-client-python/blob/cf4a9c0572e7232b315179f78c28d4c653f9119c/pulsar/__init__.py#L1003) [send_async](https://github.com/apache/pulsar-client-python/blob/cf4a9c0572e7232b315179f78c28d4c653f9119c/pulsar/__init__.py#L1049) It is not quite clear to me which of these function arguments allows for the setting of the compaction key, if any. Alternatively, there is actually some nice documentation for the Java client [on the Pulsar docs site](https://pulsar.apache.org/docs/3.0.x/cookbooks-compaction/#configure-consumers). With the Java client, you can set the key with something like this: ``` compactedTopicProducer.newMessage() .key("some-key") .value(someByteArray) .send(); ``` Is there an equivalent bit of functionality for the python client? GitHub link: https://github.com/apache/pulsar/discussions/20360 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
