Bulk publish: per-message metadata in publish_events
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 76/100
Research direction
Start in dapr/clients/grpc/client.py#L544 and dapr/aio/clients/grpc/client.py#L493, where publish_events builds BulkPublishRequestEntry values from entry_id, event, and content_type. Add support for BulkPublishEntry metadata while preserving bytes and str entries, and ensure publish_metadata is copied to every entry; done means per-message metadata and request-level metadata reach bulk publish envelopes.
Written by the indexing model from the issue text.
Description
Describe the feature
publish_events does not populate BulkPublishRequestEntry.metadata, so per-message metadata (partition key, session id, Kafka key) cannot be set. Entries are built from entry_id, event and content_type only, in both dapr/clients/grpc/client.py#L544 and dapr/aio/clients/grpc/client.py#L493.
The runtime supports it, and go-sdk (PublishEventsEvent.Metadata), java-sdk (BulkPublishEntry) and js-sdk (PubSubBulkPublishMessage.metadata) all expose it. Same request against dotnet-sdk in dapr/dotnet-sdk#1198.
Side effect: the runtime only merges request-level metadata into entries that already have metadata, so publish_metadata never reaches the envelope either. On 1.18.4 with ttlInSeconds, publish_event sets expiration on the cloudevent and publish_events does not.
Proposed API, mirroring go-sdk:
d.publish_events(
pubsub_name='pubsub',
topic_name='TOPIC_A',
data=[
BulkPublishEntry(event='{"n": 1}', metadata={'partitionKey': 'tenant-a'}),
BulkPublishEntry(event='{"n": 2}', metadata={'partitionKey': 'tenant-b'}),
'{"n": 3}',
],
)
Existing bytes/str entries keep working, and publish_metadata should be copied onto every entry.
Release Note
RELEASE NOTE: ADD Per-message metadata support in publish_events bulk publish.
- Dominant language
- Python
- Stars
- 272
- Forks
- 152
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dapr/python-sdk
-
dapr-ext-workflow good first issue kind/enhancement P2
Difficulty 2/5 1-2 days Newbie friendliness 72/100
dapr/python-sdk#853 · 4 comments ·
-
dapr-ext-workflow kind/enhancement
Difficulty 3/5 1-2 days Newbie friendliness 78/100
dapr/python-sdk#1213 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
dapr/python-sdk#1200 ·
-
dapr-ext-workflow kind/enhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
dapr/python-sdk#1188 ·
-
dapr-ext-workflow kind/enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
dapr/python-sdk#1181 · 1 assignee ·
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·