chibenwa commented on code in PR #2817:
URL: https://github.com/apache/james-project/pull/2817#discussion_r2376110192
##########
server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java:
##########
@@ -213,4 +226,63 @@ private Stream<MailboxMetaData>
listUserMailboxes(MailboxSession mailboxSession)
.toStream();
}
+ public Mono<Result> runRulesOnMailbox(Username username, MailboxName
mailboxName, Rules rules, RunRulesOnMailboxTask.Context context) {
+ MailboxSession mailboxSession =
mailboxManager.createSystemSession(username);
+ RuleMatcher ruleMatcher = new RuleMatcher(rules.getRules());
+
+ return
Mono.from(mailboxManager.getMailboxReactive(MailboxPath.forUser(username,
mailboxName.asString()), mailboxSession))
+ .flatMapMany(messageManager ->
Flux.from(messageManager.getMessagesReactive(MessageRange.all(),
FetchGroup.HEADERS, mailboxSession))
+ .concatMap(Throwing.function(messageResult ->
runRulesOnMessage(ruleMatcher, messageResult, mailboxSession, context))))
Review Comment:
IMO that's maybe a bit harsh
We could `flatmap` + `LOW_CONCURRENCY` ?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]