-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix(email-inbound-connector): implement a reconnect and reopen mechanism #3506
fix(email-inbound-connector): implement a reconnect and reopen mechanism #3506
Conversation
b0c267a
to
7bc2c81
Compare
… for folder creation, and add unit tests
try { | ||
this.jakartaUtils.connectStore(store, authentication); | ||
} catch (MessagingException e) { | ||
throw new RuntimeException("Could not reconnect to store"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the exception to the log so we can find out what failed?
try { | ||
this.folder.open(Folder.READ_WRITE); | ||
} catch (MessagingException e) { | ||
throw new RuntimeException("Could not reopen folder"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -130,7 +130,7 @@ private MoveEmailResponse imapMoveEmails( | |||
sourceImapFolder.open(Folder.READ_WRITE); | |||
Folder targetImapFolder = | |||
store.getFolder( | |||
String.join(String.valueOf(rootFolder.getSeparator()), toFolder.split("\\."))); | |||
String.join(String.valueOf(rootFolder.getSeparator()), toFolder.split("[./]"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a constant for this.
@@ -321,7 +321,7 @@ public void moveMessage(Store store, Message message, String targetFolder) { | |||
char separator = imapFolder.getSeparator(); | |||
String targetFolderFormatted = | |||
Optional.ofNullable(targetFolder) | |||
.map(string -> string.split("\\.")) | |||
.map(string -> string.split("[./]")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and use this constant here as well?
Or create a simple static method for this logic. Would be even better
@@ -321,7 +321,7 @@ public void moveMessage(Store store, Message message, String targetFolder) { | |||
char separator = imapFolder.getSeparator(); | |||
String targetFolderFormatted = | |||
Optional.ofNullable(targetFolder) | |||
.map(string -> string.split("\\.")) | |||
.map(string -> string.split("[./]")) | |||
.map(strings -> String.join(String.valueOf(separator), strings)) | |||
.orElse("temp"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we dont need this fallback.
… for folder creation, and add unit tests 2
.map(strings -> String.join(String.valueOf(separator), strings)) | ||
.orElse("temp"); | ||
.orElseThrow(() -> new RuntimeException("No folder has been set")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.orElseThrow(() -> new RuntimeException("No folder has been set")); | |
.orElseThrow(() -> new RuntimeException("No target folder has been set")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release/8.6
git worktree add -d .worktree/backport-3506-to-release/8.6 origin/release/8.6
cd .worktree/backport-3506-to-release/8.6
git switch --create backport-3506-to-release/8.6
git cherry-pick -x be06a0ee548f5049437bf24b54b2e730cdf1c582 |
…ism (#3506) * fix(email-inbound-connector): implement a reconnect and reopen mechanism * fix(email-connectors): add equalsIgnoreCase for INBOX * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests 2
…ism (#3506) * fix(email-inbound-connector): implement a reconnect and reopen mechanism * fix(email-connectors): add equalsIgnoreCase for INBOX * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests 2
/backport |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release/8.6
git worktree add -d .worktree/backport-3506-to-release/8.6 origin/release/8.6
cd .worktree/backport-3506-to-release/8.6
git switch --create backport-3506-to-release/8.6
git cherry-pick -x be06a0ee548f5049437bf24b54b2e730cdf1c582 |
…ism (#3506) * fix(email-inbound-connector): implement a reconnect and reopen mechanism * fix(email-connectors): add equalsIgnoreCase for INBOX * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests 2 (cherry picked from commit be06a0e)
…ism (#3506) * fix(email-inbound-connector): implement a reconnect and reopen mechanism * fix(email-connectors): add equalsIgnoreCase for INBOX * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests 2 (cherry picked from commit be06a0e)
…ism (#3506) * fix(email-inbound-connector): implement a reconnect and reopen mechanism * fix(email-connectors): add equalsIgnoreCase for INBOX * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests * fix(email-inbound-connector): add integration tests, modify the split for folder creation, and add unit tests 2
Description
As asked by @sbuettner this PR implements a re connect / re open mechanism
Related issues
closes #
Checklist
no milestone
label.