Skip to content

Conversation

@MrBlueMoo
Copy link
Contributor

Duplicate of #9659 for main!

Description

This functionality allows for delayed delivery options within Apache Pulsar to be used by specifying a time that you want the message to be delivered.

This is simply is a passthrough for setting the deliverAt() on an Apache Pulsar message used used by the producer. The expected value is a Long representing the current timestamp in milliseconds (UTC) which is simply passed across without translation.

The detail of the call used is as follows:
https://pulsar.apache.org/api/client/2.11.x/org/apache/pulsar/client/api/TypedMessageBuilder.html#deliverAt(long)

Uses the CamelPulsarProducerMessageDeliverAt header name for setting.

Target

  • I checked that the commit is targeting the correct branch (note that Camel 3 uses camel-3.x, whereas Camel 4 uses the main branch)

Tracking

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.

  • I formatted the code using mvn -Pformat,fastinstall install && mvn -Psourcecheck

message used when sending Apache Pulsar messages to allow for delayed
delivery. Uses the CamelPulsarProducerMessageDeliverAt header name for
setting.
@github-actions
Copy link
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟

⚠️ Please note that the changes on this PR may be tested automatically.

If necessary Apache Camel Committers may access logs and test results in the job summaries!

@davsclaus
Copy link
Contributor

Can the description of the header be a bit more improved. The time is in millis since epoch and I assume its the local time where the client is running. And what happens if the time is in the past? Or if the time is too far in the future (eg +1 year or something) ?

@davsclaus
Copy link
Contributor

Ah you can copy their javadoc as its better

Deliver the message only at or after the specified absolute timestamp.
The timestamp is milliseconds and based on UTC (eg: [System.currentTimeMillis()](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/System.html#currentTimeMillis()).

Note: messages are only delivered with delay when a consumer is consuming through a [SubscriptionType.Shared](https://pulsar.apache.org/api/client/2.11.x/org/apache/pulsar/client/api/SubscriptionType.html#Shared) subscription. With other subscription types, the messages will still be delivered immediately.

@davsclaus davsclaus merged commit dad6eb6 into apache:main Mar 29, 2023
davsclaus pushed a commit that referenced this pull request Mar 29, 2023
…9660)

message used when sending Apache Pulsar messages to allow for delayed
delivery. Uses the CamelPulsarProducerMessageDeliverAt header name for
setting.
@MrBlueMoo
Copy link
Contributor Author

@davsclaus Thank you, much appreciated, and yes good call on adding additional detail to the description which I see you already actioned (you beat me to it)! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants