This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 8d917e0672da CAMEL-23046: camel-mail - If configured a
IdempotentRepository then it should be auto started
8d917e0672da is described below
commit 8d917e0672da51a941617b556a68c4c0b573e62f
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Feb 23 19:19:58 2026 +0100
CAMEL-23046: camel-mail - If configured a IdempotentRepository then it
should be auto started
---
.../org/apache/camel/component/mail/MailEndpoint.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git
a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
index 6976c9de847a..c178fe7350c7 100644
---
a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
+++
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
@@ -33,6 +33,7 @@ import org.apache.camel.spi.IdempotentRepository;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.support.ScheduledPollEndpoint;
+import org.apache.camel.support.service.ServiceHelper;
import org.eclipse.angus.mail.imap.SortTerm;
import static
org.apache.camel.component.mail.MailConstants.MAIL_GENERATE_MISSING_ATTACHMENT_NAMES_NEVER;
@@ -163,6 +164,23 @@ public class MailEndpoint extends ScheduledPollEndpoint
implements HeaderFilterS
return exchange;
}
+ @Override
+ protected void doStart() throws Exception {
+ // idempotent repository may be used by others, so add it as a service
+ // so its stopped when CamelContext stops
+ if (idempotentRepository != null) {
+ getCamelContext().addService(idempotentRepository, true);
+ }
+ ServiceHelper.startService(idempotentRepository);
+ super.doStart();
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ super.doStop();
+ ServiceHelper.stopService(idempotentRepository);
+ }
+
// Properties
//
-------------------------------------------------------------------------