Skip to content

pubsub/pstest: support message ordering #6255

@arriven

Description

@arriven

Is your feature request related to a problem? Please describe.
As of right now, fake pubsub subscriptions completely ignore ordering key (it forwards it to the client which handles the invariant of not processing two messages with the same ordering key at once but the order is random). We have a distributed processing algorithm that depends on order of messages with the same key (we need to write last version to the DB) and right now testing it requires using real pubsub/emulator which are a pain for the CI system.

Describe the solution you'd like
pstest fake server should handle message ordering with the same guarantees the real instance has.

Describe alternatives you've considered
Using emulator or real gcp pubsub for CI but it bloats the costs unnecessarily.

Additional context
The issue is caused by the fact that ordering keys are completely ignored by the fake subscription logic and the messages are delivered in a completely random order regardless of the settings (see code, golang map is not ordered by keys but even if it were IDs are compared lexographically as strings, meaning 10 < 2).

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions