You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2015/11/28 16:33:04 UTC
svn commit: r1716990 - in /james/project/trunk:
mailbox/api/src/main/java/org/apache/james/mailbox/
mailbox/api/src/test/java/org/apache/james/mailbox/
mailbox/api/src/test/java/org/apache/james/mailbox/util/
mailbox/caching/src/main/java/org/apache/ja...
Author: btellier
Date: Sat Nov 28 15:33:04 2015
New Revision: 1716990
URL: http://svn.apache.org/viewvc?rev=1716990&view=rev
Log:
MAILBOX-259 Adding a mixed mode, where Event delivery is either synchronous or asynchronous, depending of the indications given by the listeners
Added:
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MixedEventDelivery.java
james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MixedEventDeliveryTest.java
james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/WaitMailboxListener.java
Modified:
james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java
james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java
james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/util/EventCollector.java
james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java
james/project/trunk/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/DefaultDelegatingMailboxListener.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/BroadcastDelegatingMailboxListener.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/RegisteredDelegatingMailboxListener.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/AsynchronousEventDeliveryTest.java
james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
james/project/trunk/server/app/src/main/resources/events-template.xml
james/project/trunk/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/EventsConfigurationBeanFactoryPostProcessor.java
Modified: james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java (original)
+++ james/project/trunk/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java Sat Nov 28 15:33:04 2015
@@ -40,8 +40,15 @@ public interface MailboxListener {
MAILBOX
}
+ enum ExecutionMode {
+ SYNCHRONOUS,
+ ASYNCHRONOUS
+ }
+
ListenerType getType();
+ ExecutionMode getExecutionMode();
+
/**
* Informs this listener about the given event.
*
Modified: james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java (original)
+++ james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractStressTest.java Sat Nov 28 15:33:04 2015
@@ -65,6 +65,11 @@ public abstract class AbstractStressTest
}
@Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.SYNCHRONOUS;
+ }
+
+ @Override
public void event(Event event) {
long u = ((Added) event).getUids().get(0);
uList.add(u);
Modified: james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/util/EventCollector.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/util/EventCollector.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/util/EventCollector.java (original)
+++ james/project/trunk/mailbox/api/src/test/java/org/apache/james/mailbox/util/EventCollector.java Sat Nov 28 15:33:04 2015
@@ -43,6 +43,11 @@ public class EventCollector implements M
return listenerType;
}
+ @Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.SYNCHRONOUS;
+ }
+
public List<Event> getEvents() {
return events;
}
Modified: james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java (original)
+++ james/project/trunk/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheInvalidatingMailboxListener.java Sat Nov 28 15:33:04 2015
@@ -36,6 +36,11 @@ public class CacheInvalidatingMailboxLis
}
@Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.SYNCHRONOUS;
+ }
+
+ @Override
public void event(Event event) {
// TODO this needs for sure to be smarter
try {
Modified: james/project/trunk/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml (original)
+++ james/project/trunk/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml Sat Nov 28 15:33:04 2015
@@ -77,4 +77,9 @@
<constructor-arg index="0" ref="${event.delivery.thread.count}"/>
</bean>
+ <bean id="mixed-event-delivery" class="org.apache.james.mailbox.store.event.MixedEventDelivery" lazy-init="true">
+ <constructor-arg index="0" ref="asynchronous-event-delivery"/>
+ <constructor-arg index="1" ref="synchronous-event-delivery"/>
+ </bean>
+
</beans>
\ No newline at end of file
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/DefaultDelegatingMailboxListener.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/DefaultDelegatingMailboxListener.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/DefaultDelegatingMailboxListener.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/DefaultDelegatingMailboxListener.java Sat Nov 28 15:33:04 2015
@@ -42,6 +42,11 @@ public class DefaultDelegatingMailboxLis
return ListenerType.EACH_NODE;
}
+ @Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.SYNCHRONOUS;
+ }
+
public DefaultDelegatingMailboxListener() {
this(new SynchronousEventDelivery());
}
Added: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MixedEventDelivery.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MixedEventDelivery.java?rev=1716990&view=auto
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MixedEventDelivery.java (added)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MixedEventDelivery.java Sat Nov 28 15:33:04 2015
@@ -0,0 +1,48 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.event;
+
+import org.apache.james.mailbox.MailboxListener;
+
+public class MixedEventDelivery implements EventDelivery {
+
+ private final AsynchronousEventDelivery asynchronousEventDelivery;
+ private final SynchronousEventDelivery synchronousEventDelivery;
+
+ public MixedEventDelivery(AsynchronousEventDelivery asynchronousEventDelivery,
+ SynchronousEventDelivery synchronousEventDelivery) {
+ this.asynchronousEventDelivery = asynchronousEventDelivery;
+ this.synchronousEventDelivery = synchronousEventDelivery;
+ }
+
+ @Override
+ public void deliver(MailboxListener mailboxListener, MailboxListener.Event event) {
+ if (mailboxListener.getExecutionMode().equals(MailboxListener.ExecutionMode.SYNCHRONOUS)) {
+ synchronousEventDelivery.deliver(mailboxListener, event);
+ } else {
+ asynchronousEventDelivery.deliver(mailboxListener, event);
+ }
+ }
+
+ public void stop() {
+ asynchronousEventDelivery.stop();
+ }
+
+}
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/BroadcastDelegatingMailboxListener.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/BroadcastDelegatingMailboxListener.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/BroadcastDelegatingMailboxListener.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/BroadcastDelegatingMailboxListener.java Sat Nov 28 15:33:04 2015
@@ -72,6 +72,11 @@ public class BroadcastDelegatingMailboxL
}
@Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.SYNCHRONOUS;
+ }
+
+ @Override
public void addListener(MailboxPath mailboxPath, MailboxListener listener, MailboxSession session) throws MailboxException {
mailboxListenerRegistry.addListener(mailboxPath, listener);
}
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/RegisteredDelegatingMailboxListener.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/RegisteredDelegatingMailboxListener.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/RegisteredDelegatingMailboxListener.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/RegisteredDelegatingMailboxListener.java Sat Nov 28 15:33:04 2015
@@ -73,6 +73,11 @@ public class RegisteredDelegatingMailbox
}
@Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.SYNCHRONOUS;
+ }
+
+ @Override
public void addListener(MailboxPath path, MailboxListener listener, MailboxSession session) throws MailboxException {
mailboxListenerRegistry.addListener(path, listener);
mailboxPathRegister.register(path);
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java Sat Nov 28 15:33:04 2015
@@ -50,6 +50,11 @@ public class ListeningCurrentQuotaUpdate
}
@Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.ASYNCHRONOUS;
+ }
+
+ @Override
public void event(Event event) {
try {
QuotaRoot quotaRoot = quotaRootResolver.getQuotaRoot(event.getMailboxPath());
Modified: james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java (original)
+++ james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java Sat Nov 28 15:33:04 2015
@@ -49,8 +49,12 @@ public abstract class ListeningMessageSe
public ListeningMessageSearchIndex(MessageMapperFactory<Id> factory) {
this.factory = factory;
}
-
-
+
+ @Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.ASYNCHRONOUS;
+ }
+
/**
* Return the {@link MessageMapperFactory}
*
Modified: james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/AsynchronousEventDeliveryTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/AsynchronousEventDeliveryTest.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/AsynchronousEventDeliveryTest.java (original)
+++ james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/AsynchronousEventDeliveryTest.java Sat Nov 28 15:33:04 2015
@@ -30,43 +30,9 @@ import org.apache.james.mailbox.mock.Moc
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.atomic.AtomicLong;
public class AsynchronousEventDeliveryTest {
- public class WaitMailboxListener implements MailboxListener {
-
- private final AtomicLong invocationCount;
-
- public WaitMailboxListener() {
- invocationCount = new AtomicLong(0);
- }
-
- public AtomicLong getInvocationCount() {
- return invocationCount;
- }
-
- @Override
- public ListenerType getType() {
- return ListenerType.MAILBOX;
- }
-
- @Override
- public void event(Event event) {
- try {
- Thread.sleep(100);
- invocationCount.incrementAndGet();
- } catch (InterruptedException e) {
- LOGGER.info("interrupted", e);
- }
- }
- }
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AsynchronousEventDeliveryTest.class);
-
private MailboxListener mailboxListener;
private AsynchronousEventDelivery asynchronousEventDelivery;
Added: james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MixedEventDeliveryTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MixedEventDeliveryTest.java?rev=1716990&view=auto
==============================================================================
--- james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MixedEventDeliveryTest.java (added)
+++ james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MixedEventDeliveryTest.java Sat Nov 28 15:33:04 2015
@@ -0,0 +1,63 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.event;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.james.mailbox.MailboxListener;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+
+public class MixedEventDeliveryTest {
+
+ private MixedEventDelivery mixedEventDelivery;
+
+ @Before
+ public void setUp() {
+ mixedEventDelivery = new MixedEventDelivery(new AsynchronousEventDelivery(2), new SynchronousEventDelivery());
+ }
+
+ @After
+ public void tearDown() {
+ mixedEventDelivery.stop();
+ }
+
+ @Test
+ public void deliverShouldWorkOnSynchronousListeners() throws Exception {
+ WaitMailboxListener listener = new WaitMailboxListener(MailboxListener.ExecutionMode.SYNCHRONOUS);
+ MailboxListener.Event event = new MailboxListener.Event(null, null) {};
+ mixedEventDelivery.deliver(listener, event);
+ assertThat(listener.getInvocationCount().get()).isEqualTo(1);
+ }
+
+ @Test
+ public void deliverShouldWorkOnAsynchronousListeners() throws Exception {
+ WaitMailboxListener listener = new WaitMailboxListener(MailboxListener.ExecutionMode.ASYNCHRONOUS);
+ MailboxListener.Event event = new MailboxListener.Event(null, null) {};
+ mixedEventDelivery.deliver(listener, event);
+ assertThat(listener.getInvocationCount().get()).isEqualTo(0);
+ Thread.sleep(200);
+ assertThat(listener.getInvocationCount().get()).isEqualTo(1);
+ }
+
+}
Added: james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/WaitMailboxListener.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/WaitMailboxListener.java?rev=1716990&view=auto
==============================================================================
--- james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/WaitMailboxListener.java (added)
+++ james/project/trunk/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/WaitMailboxListener.java Sat Nov 28 15:33:04 2015
@@ -0,0 +1,48 @@
+package org.apache.james.mailbox.store.event;
+
+import org.apache.james.mailbox.MailboxListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+public class WaitMailboxListener implements MailboxListener {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(WaitMailboxListener.class);
+
+ private final AtomicLong invocationCount;
+ private final ExecutionMode executionMode;
+
+ public WaitMailboxListener(ExecutionMode executionMode) {
+ this.invocationCount = new AtomicLong(0);
+ this.executionMode = executionMode;
+ }
+
+ public WaitMailboxListener() {
+ this(ExecutionMode.ASYNCHRONOUS);
+ }
+
+ public AtomicLong getInvocationCount() {
+ return invocationCount;
+ }
+
+ @Override
+ public ListenerType getType() {
+ return ListenerType.MAILBOX;
+ }
+
+ @Override
+ public ExecutionMode getExecutionMode() {
+ return executionMode;
+ }
+
+ @Override
+ public void event(Event event) {
+ try {
+ Thread.sleep(100);
+ invocationCount.incrementAndGet();
+ } catch (InterruptedException e) {
+ LOGGER.info("interrupted", e);
+ }
+ }
+}
Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java Sat Nov 28 15:33:04 2015
@@ -194,5 +194,10 @@ public class IdleProcessor extends Abstr
public ListenerType getType() {
return ListenerType.MAILBOX;
}
+
+ @Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.ASYNCHRONOUS;
+ }
}
}
Modified: james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java (original)
+++ james/project/trunk/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java Sat Nov 28 15:33:04 2015
@@ -107,6 +107,11 @@ public class SelectedMailboxImpl impleme
return ListenerType.MAILBOX;
}
+ @Override
+ public ExecutionMode getExecutionMode() {
+ return ExecutionMode.SYNCHRONOUS;
+ }
+
private void init() throws MailboxException {
MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
Modified: james/project/trunk/server/app/src/main/resources/events-template.xml
URL: http://svn.apache.org/viewvc/james/project/trunk/server/app/src/main/resources/events-template.xml?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/server/app/src/main/resources/events-template.xml (original)
+++ james/project/trunk/server/app/src/main/resources/events-template.xml Sat Nov 28 15:33:04 2015
@@ -32,6 +32,7 @@
If yes set this to synchronous
If no set this to asynchronous
+ If you want to use default supported behaviour exposed by listeners set this to mixed
-->
<delivery>synchronous</delivery>
Modified: james/project/trunk/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/EventsConfigurationBeanFactoryPostProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/EventsConfigurationBeanFactoryPostProcessor.java?rev=1716990&r1=1716989&r2=1716990&view=diff
==============================================================================
--- james/project/trunk/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/EventsConfigurationBeanFactoryPostProcessor.java (original)
+++ james/project/trunk/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/EventsConfigurationBeanFactoryPostProcessor.java Sat Nov 28 15:33:04 2015
@@ -43,7 +43,7 @@ public class EventsConfigurationBeanFact
String delegatingListenerAlias = getDelegatingListenerAlias(type);
String serializationAlias = getSerializationAlias(serialization);
String registrationAlias = getRegistrationAlias(registration);
- String deliveryAlias = null;
+ String deliveryAlias = getDeliveryString(delivery);
String publisherAlias = null;
String consumerAlias = null;
@@ -52,12 +52,6 @@ public class EventsConfigurationBeanFact
consumerAlias = "kafka-consumer";
}
- if (delivery.equals("synchronous")) {
- deliveryAlias = "synchronous-event-delivery";
- } else if (delivery.equals("asynchronous")) {
- deliveryAlias = "asynchronous-event-delivery";
- }
-
detectInvalidValue(delegatingListenerAlias, "Delegating listener type " + type + " not supported!");
detectInvalidValue(deliveryAlias, "Event delivery " + delivery + " not supported");
beanFactory.registerAlias(delegatingListenerAlias, "delegating-listener");
@@ -111,4 +105,15 @@ public class EventsConfigurationBeanFact
}
return null;
}
+
+ public String getDeliveryString(String delivery) {
+ if (delivery.equals("synchronous")) {
+ return "synchronous-event-delivery";
+ } else if (delivery.equals("asynchronous")) {
+ return "asynchronous-event-delivery";
+ } else if (delivery.equals("mixed")) {
+ return "mixed-event-delivery";
+ }
+ return null;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org