camel
camel copied to clipboard
CAMEL-17803: Fix/reimplement automatic complete/abandon of messages
updates to manually call complete/abandon on the service bus client for a service bus consumer.
Opening to get some feedback on this, I'm unsure about some implementation details, mainly:
-
is there a better way to get the original message than saving it as an exchange property?
-
the combination of the
OnConsumerCompletion.onFailure
and theonErrorListener
subscription on thereceiveMessages.subscribe()
was causing the error handler to be invoked twice, so i wasn't sure the best way to handle that. -
I also wasn't sure how creating a custom exception handler would interact with a user-specified exception handler. would marking an exchange as
handled
within a custom error handler call back to the givenConsumerOnCompletion.onComplete
? -
[x] Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
-
[ ] Each commit in the pull request should have a meaningful subject line and body.
-
[ ] If you're unsure, you can format the pull request title like
[CAMEL-XXX] Fixes bug in camel-file component
, where you replaceCAMEL-XXX
with the appropriate JIRA issue. -
[ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
-
[ ] Run
mvn clean install -Psourcecheck
in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically. Below are the contribution guidelines: https://github.com/apache/camel/blob/main/CONTRIBUTING.md
@oscerd, @vachillo , I was looking to use this camel component for dead lettering a message. https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dead-letter-queues#application-level-dead-lettering
With Azure Java SDK , we would do that as serviceBusReceiverAsyncClient.deadLetter(ServiceBusReceivedMessage message). I could not find any means to do that in the current camel version. Meanwhile, I see that the fix you are providing is very similar to this requirement.
@davsclaus can you take a look too?
Also it would be good to get some documentation about this change, eg maybe add a section to the doc (see src/main/docs folder) about using auto commit enabled vs disabled and how this automatic complete/abandon
@vachillo thanks for providing this PR. Have you maybe already run the tests. For me they either fail:
[ERROR] org.apache.camel.component.azure.servicebus.integration.ServiceBusConsumerTest.testReceiveMessages Time elapsed: 1.623 s <<< FAILURE!
java.lang.AssertionError: mock://receiveMessagesResult Body of message: 0. Expected: <test batch 1> but was: <test batch 3>
Or hang:
[INFO] Running org.apache.camel.component.azure.servicebus.integration.ServiceBusProducerTest
For running tests I have first exported the 3 ENV variables below, and then:
mvn clean verify -DconnectionString=$connectionString -DtopicName=$topicName -DsubscriptionName=$subscriptionName
I have also hit this issue. Is there any way to speed up the resolve? Also, in camel-k (yaml) I cannot set disableAutoComplete to true and manually call complete/abandon, as there is no documented way to do so. Error-Handling is currently flawed in this component
in camel-k you can configure any camel component with its options either in modeline or a config value
The PR is incomplete. You can fork the branch and start to work on it
This has been implemented by (in other PRs) https://issues.apache.org/jira/browse/CAMEL-19155