Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Bulk publish: per-message metadata in publish_events

Open
#1,214 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
grpc, python
Domain
api, backend

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

feature-request

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dapr/python-sdk

All issues in dapr/python-sdk

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.