Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAMEL-21589: Enable manual acks mqtt5 #16702

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ravjotbrar
Copy link

@ravjotbrar ravjotbrar commented Jan 3, 2025

Description

This PR implements a new parameter called manualAcksEnabled, which would make it possible for the user to enable manual acknowledgements in the client. By default, the parameter is set to false and messages will be automatically acknowledged. If set to true, the acknowledgement is added in the exchange's completion callback.

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

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

Ravjot Brar (Bit Quill Technologies Inc) added 3 commits January 3, 2025 12:07
Copy link
Contributor

github-actions bot commented Jan 3, 2025

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

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@@ -88,6 +88,8 @@ public class PahoMqtt5Configuration implements Cloneable {
private int executorServiceTimeout = 1;
@UriParam(defaultValue = "-1")
private long sessionExpiryInterval = -1;
@UriParam(defaultValue = "false")
private boolean manualAcksEnabled = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

a boolean is false by default, so remove

*
*/
public boolean isManualAcksEnabled() {

Copy link
Contributor

Choose a reason for hiding this comment

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

remove empty line

try {
PahoMqtt5Consumer.this.client.messageArrivedComplete(mqttMessage.getId(), mqttMessage.getQos());
} catch (MqttException e) {
throw new RuntimeException(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

dont rethrown but log a WARN about not able to commit


@Override
public void onFailure(Exchange exchange) {
LOG.error("Error: " + exchange.getExchangeId(), exchange.getException());
Copy link
Contributor

Choose a reason for hiding this comment

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

A better description, such as "Rollback message due to error processing ..."

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