You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/05/14 06:42:42 UTC
[james-project] 10/15: JAMES-3148 DeleteMessageListener can easily
be fully reactive
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit e59801c614f8dc8bde68fdbf0f9bbdb569a37e03
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri May 7 18:47:23 2021 +0700
JAMES-3148 DeleteMessageListener can easily be fully reactive
---
.../james/mailbox/cassandra/DeleteMessageListener.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/DeleteMessageListener.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/DeleteMessageListener.java
index 2deefad..25af4c3 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/DeleteMessageListener.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/DeleteMessageListener.java
@@ -62,6 +62,7 @@ import org.apache.james.mailbox.model.MessageMetaData;
import org.apache.james.mailbox.model.MessageRange;
import org.apache.james.mailbox.store.mail.MessageMapper;
import org.apache.james.util.streams.Limit;
+import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -77,7 +78,7 @@ import reactor.core.publisher.Mono;
* Mailbox listener failures lead to eventBus retrying their execution, it ensures the result of the deletion to be
* idempotent.
*/
-public class DeleteMessageListener implements EventListener.GroupEventListener {
+public class DeleteMessageListener implements EventListener.ReactiveGroupEventListener {
private static final Optional<CassandraId> ALL_MAILBOXES = Optional.empty();
public static class DeleteMessageListenerGroup extends Group {
@@ -138,21 +139,20 @@ public class DeleteMessageListener implements EventListener.GroupEventListener {
}
@Override
- public void event(Event event) {
+ public Publisher<Void> reactiveEvent(Event event) {
if (event instanceof Expunged) {
Expunged expunged = (Expunged) event;
- handleMessageDeletion(expunged)
- .block();
+ return handleMessageDeletion(expunged);
}
if (event instanceof MailboxDeletion) {
MailboxDeletion mailboxDeletion = (MailboxDeletion) event;
CassandraId mailboxId = (CassandraId) mailboxDeletion.getMailboxId();
- handleMailboxDeletion(mailboxId)
- .block();
+ return handleMailboxDeletion(mailboxId);
}
+ return Mono.empty();
}
private Mono<Void> handleMailboxDeletion(CassandraId mailboxId) {
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org