Skip to content

add messageId and topic as props of DLQ message - #907

Merged
wolfstudy merged 1 commit into
apache:masterfrom
GPrabhudas:dlq-msg-props
Jan 10, 2023
Merged

wolfstudy merged 1 commit into
apache:masterfrom
GPrabhudas:dlq-msg-props

Conversation

@GPrabhudas

Copy link
Copy Markdown
Contributor

addresses issue #906

Comment thread pulsar/reader_test.go Resolved

@wolfstudy wolfstudy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@wolfstudy wolfstudy added this to the v0.10.0 milestone Jan 10, 2023
@wolfstudy
wolfstudy merged commit cf031b8 into apache:master Jan 10, 2023
RobertIndie pushed a commit that referenced this pull request Aug 7, 2025
…meLater() (#1392)

Fixes #1388
Master Issue: #907, apache/pulsar#23182

### Motivation
Since pulsar sdk does not support `AckTimeout()` method, we can only use `Nack()` or `ReconsumeLater()` to trigger dlq policy and send messages to dlq. We can find system properties(e.g. `REAL_TOPIC` and `ORIGIN_MESSAGE_ID`) in these dlq messages.

Refer to issue #1388, before pr #907 `dlq_router#run()` will directly copy properties to create a new dlq message when receiving a message from `dlq.Chan()`. But we only define message properties in ReconsumeLater's `ReconsumeLaterWithCustomProperties()` and not in Nack's `dispatcher()` before send to this `dlq.Chan()`, which lead to only dlq messages created by `ReconsumeLater()` can have these properties.

The above pr replaced this behavior with just adding system properties as soon as creating dlq messages in `dlq_router#run()`, which use `message.topic` as `REAL_TOPIC` property value. But messages sent from `ReconsumeLater() ReconsumeLaterWithCustomProperties()` do not contain related `message.topic` fields, in case it will override defined `REAL_TOPIC` to empty string.

### Modifications
- Add `REAL_TOPIC`, `ORIGIN_MESSAGE_IDY_TIME`, `ORIGIN_MESSAGE_ID` system properties both in ReconsumeLater's `ReconsumeLaterWithCustomProperties()` and Nack's `dispatcher()` functions.
- Add `Key`, `OrderingKey`, `EventTime` message fields both in `ReconsumeLater() ReconsumeLaterWithCustomProperties()` and `dlq_router run()` functions to keep consistent with [Java realization](apache/pulsar#23182), so that dlq messages can preserve source message info.
- Remove adding system properties strategy in `dlq_router#run()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants