Skip to content

[Bug]: Default PubsubMessage coder will drop message id and orderingKey #23525

@TheNeuralBit

Description

@TheNeuralBit

What happened?

We register multiple coders for PubsubMessage:

public List<CoderProvider> getCoderProviders() {
return ImmutableList.of(
CoderProviders.forCoder(
TypeDescriptor.of(PubsubMessage.class), PubsubMessageWithAttributesCoder.of()),
CoderProviders.forCoder(
TypeDescriptor.of(PubsubMessage.class), PubsubMessageWithMessageIdCoder.of()),
CoderProviders.forCoder(
TypeDescriptor.of(PubsubMessage.class),
PubsubMessageWithAttributesAndMessageIdCoder.of()));

But in practice everything but the first one is a no-op. We will never use them (see #22216 (comment) for a detailed explanation). This means that in cases where the coder for a PCollection<PubsubMessage> is inferred, we will use PubsubMessageWithAttributesCoder, which does not handle messageID or orderingKey.

Issue Priority

Priority: 2

Issue Component

Component: io-java-gcp

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions