orpiske commented on code in PR #16702:
URL: https://github.com/apache/camel/pull/16702#discussion_r1905540845
##########
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:
I wasn't very clear in my review. I meant that I suggested you to do this:
```LOG.error("Rollback due to error processing Exchange ID: {}",
exchange.getExchangeId(), exchange.getException());```
I don't think you need actual SLF4J log markers here. Just the `{}` 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]