Skip to content

Compacted topic ... how to get the most recent message? #380

Description

@HeikoMueller

I am struggeling with reading from a compacted topic. How would I set up a consumer or a reader that receives the most recent message (published before starting up the client) on a compacted topic? I am only able to receive either all messages or none. I tried settting up the consumer with these options:

{
topic: "persistent://public/default/topic",
subscription: 'sub-1',
subscriptionType: 'Exclusive',
subscriptionInitialPosition: 'Earliest',
readCompacted: true,
}
{
topic: "persistent://public/default/topic",
subscription: 'sub-1',
subscriptionType: 'Exclusive',
subscriptionInitialPosition: 'Latest',
readCompacted: true,
}

...and for the reader:
{
topic: 'persistent://public/default/topic',
startMessageId: Pulsar.MessageId.latest(),
readCompacted: true
}
{
topic: 'persistent://public/default/topic',
startMessageId: Pulsar.MessageId.eariest(),
readCompacted: true
}

Am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions