This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 860b654cb4f84ab3a69196de2968143d4f619780 Author: Masa Horiyama <masa.horiy...@toasttab.com> AuthorDate: Mon Aug 12 23:44:50 2019 -0400 Update Javadocs. --- .../component/pulsar/PulsarMessageReceipt.java | 35 ++++++++++++++++++++++ .../pulsar/PulsarMessageReceiptFactory.java | 9 ++++++ 2 files changed, 44 insertions(+) diff --git a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageReceipt.java b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageReceipt.java index 8f389ca..7cdfd90 100644 --- a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageReceipt.java +++ b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageReceipt.java @@ -17,18 +17,53 @@ package org.apache.camel.component.pulsar; import java.util.concurrent.CompletableFuture; +import org.apache.camel.Exchange; +import org.apache.camel.component.pulsar.configuration.PulsarConfiguration; +import org.apache.pulsar.client.api.MessageId; import org.apache.pulsar.client.api.PulsarClientException; +/** + * Acknowledge the receipt of a message using the Pulsar consumer. + * <p> + * Available on the {@link Exchange} if {@link PulsarConfiguration#isAllowManualAcknowledgement()} is true. + * An alternative to the default may be provided by implementing {@link PulsarMessageReceiptFactory}. + */ public interface PulsarMessageReceipt { + /** + * Acknowledge receipt of this message synchronously. + * + * @see org.apache.pulsar.client.api.Consumer#acknowledge(MessageId) + */ void acknowledge() throws PulsarClientException; + /** + * Acknowledge receipt of all of the messages in the stream up to and including this message synchronously. + * + * @see org.apache.pulsar.client.api.Consumer#acknowledgeCumulative(MessageId) + */ void acknowledgeCumulative() throws PulsarClientException; + /** + * Acknowledge receipt of this message asynchronously. + * + * @see org.apache.pulsar.client.api.Consumer#acknowledgeAsync(MessageId) + */ CompletableFuture<Void> acknowledgeAsync(); + /** + * Acknowledge receipt of all of the messages in the stream up to and including this message asynchronously. + * + * @see org.apache.pulsar.client.api.Consumer#acknowledgeCumulativeAsync(MessageId) + */ CompletableFuture<Void> acknowledgeCumulativeAsync(); + /** + * Acknowledge the failure to process this message. + * + * @see org.apache.pulsar.client.api.Consumer#negativeAcknowledge(MessageId) + * Note: Available in Puslar 2.4.0. Implementations with earlier versions should return an {@link java.lang.UnsupportedOperationException}. + */ void negativeAcknowledge(); } diff --git a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageReceiptFactory.java b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageReceiptFactory.java index dcaed59..314ae95 100644 --- a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageReceiptFactory.java +++ b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageReceiptFactory.java @@ -20,8 +20,17 @@ import org.apache.camel.Exchange; import org.apache.pulsar.client.api.Consumer; import org.apache.pulsar.client.api.Message; +/** + * Factory to create a new {@link PulsarMessageReceipt} to store on the {@link Exchange}. + * <p> + * Implement this interface if an alternate implementation of {@link PulsarMessageReceipt} is required + * as newer Pulsar clients may have acknowledgement functionality not yet supported by {@link DefaultPulsarMessageReceipt}. + */ public interface PulsarMessageReceiptFactory { + /** + * Creates a new instance of {@link PulsarMessageReceipt}. + */ PulsarMessageReceipt newInstance(Exchange exchange, Message message, Consumer consumer); }