You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fix] DLQ Messages will lose system properties when sent from reconsumeLater() (#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()`.
0 commit comments