This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch postgresql in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 73a585944e4bddaccba3b4c3c05bf1897b430adf Author: Quan Tran <[email protected]> AuthorDate: Mon Apr 1 15:48:41 2024 +0700 JAMES-2586 Add missing cleanup task webadmin routes --- .../org/apache/james/PostgresJamesServerMain.java | 9 +++-- .../modules/task/DistributedTaskManagerModule.java | 10 +----- ...sTaskExecutionDetailsProjectionGuiceModule.java | 40 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/server/apps/postgres-app/src/main/java/org/apache/james/PostgresJamesServerMain.java b/server/apps/postgres-app/src/main/java/org/apache/james/PostgresJamesServerMain.java index 1a481e6fb2..f4fad8d387 100644 --- a/server/apps/postgres-app/src/main/java/org/apache/james/PostgresJamesServerMain.java +++ b/server/apps/postgres-app/src/main/java/org/apache/james/PostgresJamesServerMain.java @@ -31,6 +31,7 @@ import org.apache.james.modules.BlobExportMechanismModule; import org.apache.james.modules.MailboxModule; import org.apache.james.modules.MailetProcessingModule; import org.apache.james.modules.RunArgumentsModule; +import org.apache.james.modules.TasksCleanupTaskSerializationModule; import org.apache.james.modules.blobstore.BlobStoreCacheModulesChooser; import org.apache.james.modules.blobstore.BlobStoreModulesChooser; import org.apache.james.modules.data.PostgresDLPConfigurationStoreModule; @@ -76,7 +77,9 @@ import org.apache.james.modules.server.UserIdentityModule; import org.apache.james.modules.server.WebAdminReIndexingTaskSerializationModule; import org.apache.james.modules.server.WebAdminServerModule; import org.apache.james.modules.task.DistributedTaskManagerModule; +import org.apache.james.modules.task.PostgresTaskExecutionDetailsProjectionGuiceModule; import org.apache.james.modules.vault.DeletedMessageVaultRoutesModule; +import org.apache.james.modules.webadmin.TasksCleanupRoutesModule; import org.apache.james.vault.VaultConfiguration; import com.google.common.collect.ImmutableList; @@ -106,7 +109,9 @@ public class PostgresJamesServerMain implements JamesServerMain { new UserIdentityModule(), new DLPRoutesModule(), new JmapUploadCleanupModule(), - new JmapTasksModule()); + new JmapTasksModule(), + new TasksCleanupRoutesModule(), + new TasksCleanupTaskSerializationModule()); private static final Module PROTOCOLS = Modules.combine( new IMAPServerModule(), @@ -189,7 +194,7 @@ public class PostgresJamesServerMain implements JamesServerMain { public static List<Module> chooseTaskManagerModules(PostgresJamesConfiguration configuration) { switch (configuration.eventBusImpl()) { case IN_MEMORY: - return List.of(new TaskManagerModule()); + return List.of(new TaskManagerModule(), new PostgresTaskExecutionDetailsProjectionGuiceModule()); case RABBITMQ: return List.of(new DistributedTaskManagerModule()); default: diff --git a/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/task/DistributedTaskManagerModule.java b/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/task/DistributedTaskManagerModule.java index 1812b2421c..12dd7f896a 100644 --- a/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/task/DistributedTaskManagerModule.java +++ b/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/task/DistributedTaskManagerModule.java @@ -27,14 +27,12 @@ import javax.inject.Singleton; import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.ex.ConfigurationException; -import org.apache.james.backends.postgres.PostgresModule; import org.apache.james.backends.rabbitmq.SimpleConnectionPool; import org.apache.james.core.healthcheck.HealthCheck; import org.apache.james.modules.server.HostnameModule; import org.apache.james.modules.server.TaskSerializationModule; import org.apache.james.task.TaskManager; import org.apache.james.task.eventsourcing.EventSourcingTaskManager; -import org.apache.james.task.eventsourcing.TaskExecutionDetailsProjection; import org.apache.james.task.eventsourcing.TerminationSubscriber; import org.apache.james.task.eventsourcing.WorkQueueSupplier; import org.apache.james.task.eventsourcing.distributed.CancelRequestQueueName; @@ -47,8 +45,6 @@ import org.apache.james.task.eventsourcing.distributed.RabbitMQWorkQueueReconnec import org.apache.james.task.eventsourcing.distributed.RabbitMQWorkQueueSupplier; import org.apache.james.task.eventsourcing.distributed.TerminationQueueName; import org.apache.james.task.eventsourcing.distributed.TerminationReconnectionHandler; -import org.apache.james.task.eventsourcing.postgres.PostgresTaskExecutionDetailsProjection; -import org.apache.james.task.eventsourcing.postgres.PostgresTaskExecutionDetailsProjectionModule; import org.apache.james.utils.InitializationOperation; import org.apache.james.utils.InitilizationOperationBuilder; import org.apache.james.utils.PropertiesProvider; @@ -65,21 +61,17 @@ public class DistributedTaskManagerModule extends AbstractModule { protected void configure() { install(new HostnameModule()); install(new TaskSerializationModule()); + install(new PostgresTaskExecutionDetailsProjectionGuiceModule()); - bind(PostgresTaskExecutionDetailsProjection.class).in(Scopes.SINGLETON); bind(EventSourcingTaskManager.class).in(Scopes.SINGLETON); bind(RabbitMQWorkQueueSupplier.class).in(Scopes.SINGLETON); bind(RabbitMQTerminationSubscriber.class).in(Scopes.SINGLETON); - bind(TaskExecutionDetailsProjection.class).to(PostgresTaskExecutionDetailsProjection.class); bind(TerminationSubscriber.class).to(RabbitMQTerminationSubscriber.class); bind(TaskManager.class).to(EventSourcingTaskManager.class); bind(WorkQueueSupplier.class).to(RabbitMQWorkQueueSupplier.class); bind(CancelRequestQueueName.class).toInstance(CancelRequestQueueName.generate()); bind(TerminationQueueName.class).toInstance(TerminationQueueName.generate()); - Multibinder<PostgresModule> postgresDataDefinitions = Multibinder.newSetBinder(binder(), PostgresModule.class); - postgresDataDefinitions.addBinding().toInstance(PostgresTaskExecutionDetailsProjectionModule.MODULE()); - Multibinder<SimpleConnectionPool.ReconnectionHandler> reconnectionHandlerMultibinder = Multibinder.newSetBinder(binder(), SimpleConnectionPool.ReconnectionHandler.class); reconnectionHandlerMultibinder.addBinding().to(RabbitMQWorkQueueReconnectionHandler.class); reconnectionHandlerMultibinder.addBinding().to(TerminationReconnectionHandler.class); diff --git a/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/task/PostgresTaskExecutionDetailsProjectionGuiceModule.java b/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/task/PostgresTaskExecutionDetailsProjectionGuiceModule.java new file mode 100644 index 0000000000..9f7bb0694a --- /dev/null +++ b/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/task/PostgresTaskExecutionDetailsProjectionGuiceModule.java @@ -0,0 +1,40 @@ +/**************************************************************** + * 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.modules.task; + +import org.apache.james.backends.postgres.PostgresModule; +import org.apache.james.task.eventsourcing.TaskExecutionDetailsProjection; +import org.apache.james.task.eventsourcing.postgres.PostgresTaskExecutionDetailsProjection; +import org.apache.james.task.eventsourcing.postgres.PostgresTaskExecutionDetailsProjectionModule; + +import com.google.inject.AbstractModule; +import com.google.inject.Scopes; +import com.google.inject.multibindings.Multibinder; + +public class PostgresTaskExecutionDetailsProjectionGuiceModule extends AbstractModule { + @Override + protected void configure() { + bind(TaskExecutionDetailsProjection.class).to(PostgresTaskExecutionDetailsProjection.class) + .in(Scopes.SINGLETON); + + Multibinder<PostgresModule> postgresDataDefinitions = Multibinder.newSetBinder(binder(), PostgresModule.class); + postgresDataDefinitions.addBinding().toInstance(PostgresTaskExecutionDetailsProjectionModule.MODULE()); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
