Hi all,

## Context

While contributing a way to rebuild JMAP fast messageView projection via
webadmin, we end up with the need of supporting the following actions on
the same endpoint:

Example:

  POST /users/BOB/mailboxes?task=rebuildMessageFastViewProjection
  POST /users/BOB/mailboxes?task=reIndex

ReIndexing is a task defined in mailbox-api that any backend relying on
a message search index can rely on.

rebuildMessageFastViewProjection is an action that only make sense for
products shipping JMAP.

We need a way to 'combine' both actions within one endpoint in a modular
way.

## Proposal

 - Defining a `TaskRegistration` object:

```
class TaskRegistration {
    private final TaskType taskType;
    private final TaskGenerator taskGenerator;
}

interface TaskGenerator {
    Task generate(Request request);
}
```

 - Thus a @Named task factory can collect task registration for each one
of these 03 endpoints, which can thus be defined in a modular way.

 - We can thus post ReIndexing to be using these taskDeclaration

 - And finally using them to add task=rebuildMessageFastViewProjection
support to this endpoint.

## Consequence

Each back-end can register the actions that make sense for it.

We would furthermore ship a mechanism allowing a REST resource oriented
mechanism that will prevent in the future the creation of RPC like
endpoints.

Would such a proposal make sense?

Best regards,

Benoit.

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to