orpiske commented on code in PR #16702:
URL: https://github.com/apache/camel/pull/16702#discussion_r1903922804
##########
components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Consumer.java:
##########
@@ -155,6 +160,23 @@ public Exchange createExchange(MqttMessage mqttMessage,
String topic) {
paho.setHeader(PahoMqtt5Constants.CAMEL_PAHO_MSG_PROPERTIES,
mqttMessage.getProperties());
exchange.setIn(paho);
+ if (getEndpoint().getConfiguration().isManualAcksEnabled()) {
+ exchange.getExchangeExtension().addOnCompletion(new
Synchronization() {
+ @Override
+ public void onComplete(Exchange exchange) {
+ try {
+
PahoMqtt5Consumer.this.client.messageArrivedComplete(mqttMessage.getId(),
mqttMessage.getQos());
+ } catch (MqttException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void onFailure(Exchange exchange) {
+ LOG.error("Error: " + exchange.getExchangeId(),
exchange.getException());
Review Comment:
Also, please, use log markers instead of concatenating strings.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]