You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2024/07/04 04:09:53 UTC
(james-project) 02/03: [ANTORA] Make extending section generic
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit a7f8ded01807d47d808a0c80ce51c9079fcec57b
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Tue Jul 2 10:52:29 2024 +0200
[ANTORA] Make extending section generic
---
.../assets/images/james-hexagons-extensions.png | Bin
docs/modules/customization/nav.adoc | 5 +
.../extending => customization/pages}/imap.adoc | 6 +-
docs/modules/customization/pages/index.adoc | 188 ++++++++++++++++++++-
.../pages}/mail-processing.adoc | 2 +-
.../pages}/mailbox-listeners.adoc | 6 +-
.../pages}/smtp-hooks.adoc | 6 +-
.../pages}/webadmin-routes.adoc | 6 +-
docs/modules/servers/nav.adoc | 7 +-
.../pages/distributed/configure/extensions.adoc | 2 +-
.../servers/pages/distributed/configure/imap.adoc | 2 +-
.../distributed/configure/mailetcontainer.adoc | 4 +-
.../distributed/configure/mailrepositorystore.adoc | 2 +-
.../pages/distributed/configure/webadmin.adoc | 4 +-
.../servers/pages/distributed/extending.adoc | 4 +
.../servers/pages/distributed/extending/index.adoc | 187 --------------------
docs/modules/servers/pages/distributed/index.adoc | 2 +-
.../servers/pages/distributed/objectives.adoc | 2 +-
18 files changed, 218 insertions(+), 217 deletions(-)
diff --git a/docs/modules/servers/assets/images/james-hexagons-extensions.png b/docs/modules/customization/assets/images/james-hexagons-extensions.png
similarity index 100%
rename from docs/modules/servers/assets/images/james-hexagons-extensions.png
rename to docs/modules/customization/assets/images/james-hexagons-extensions.png
diff --git a/docs/modules/customization/nav.adoc b/docs/modules/customization/nav.adoc
index 31f850eebf..a0f727fafb 100644
--- a/docs/modules/customization/nav.adoc
+++ b/docs/modules/customization/nav.adoc
@@ -1 +1,6 @@
* xref:index.adoc[]
+** xref:mail-processing.adoc[]
+** xref:mailbox-listeners.adoc[]
+** xref:smtp-hooks.adoc[]
+** xref:webadmin-routes.adoc[]
+** xref:imap.adoc[]
diff --git a/docs/modules/servers/pages/distributed/extending/imap.adoc b/docs/modules/customization/pages/imap.adoc
similarity index 87%
rename from docs/modules/servers/pages/distributed/extending/imap.adoc
rename to docs/modules/customization/pages/imap.adoc
index d531c8c019..e7d2f0673d 100644
--- a/docs/modules/servers/pages/distributed/extending/imap.adoc
+++ b/docs/modules/customization/pages/imap.adoc
@@ -1,4 +1,4 @@
-= Distributed James Server — Custom IMAP processing
+= Custom IMAP processing
:navtitle: Custom IMAP processing
James allows defining your own handler packages.
@@ -22,7 +22,7 @@ Custom configuration can be obtained through `ImapConfiguration` class via the `
A full working example is available link:https://github.com/apache/james-project/tree/master/examples/custom-imap[here].
-See this page for xref:distributed/configure/imap.adoc#_extending_imap[more details on configuring IMAP extensions].
+See this page for xref:imap.adoc#_extending_imap[more details on configuring IMAP extensions].
== IMAP additional Connection Checks
@@ -43,4 +43,4 @@ Then the custom defined ConnectionCheck can be added in `imapserver.xml` file:
<additionalConnectionChecks>org.apache.james.CrowdsecImapConnectionCheck</additionalConnectionChecks>
```
-An example for configuration is available link:https://github.com/apache/james-project/blob/master/third-party/crowdsec/sample-configuration/imapserver.xml[here].
\ No newline at end of file
+An example for configuration is available link:https://github.com/apache/james-project/blob/master/third-party/crowdsec/sample-configuration/imapserver.xml[here].
diff --git a/docs/modules/customization/pages/index.adoc b/docs/modules/customization/pages/index.adoc
index 99c4bf002b..fcc44f699b 100644
--- a/docs/modules/customization/pages/index.adoc
+++ b/docs/modules/customization/pages/index.adoc
@@ -1,3 +1,187 @@
-= Apache James Customization
-:navtitle: Customization
+= Extending server behavior
+:navtitle: Extending server behavior
+== Available extension mechanisms
+
+image::james-hexagons-extensions.png[Extension mechanisms for the James Server]
+
+The James Server exposes several interfaces allowing the user to write custom extensions in
+order to extend the James Server behavior.
+
+Writing *Mailets* and *Matchers* allows one to supply custom components for the
+xref:mail-processing.adoc[Mail Processing] and
+enables to take decisions, and implement your business logic at the transport level.
+
+Writing xref:mailbox-listeners.adoc[Mailbox listeners] enables to
+react to your user interaction with their mailbox. This powerful tool allows build advanced features
+for mail delivery servers.
+
+Writing xref:smtp-hooks.adoc[SMTP hookd] enables to
+add features to your SMTP server.
+
+Writing xref:webadmin-routes.adoc[WebAdmin routes] enables to
+add features to the WebAdmin REST API.
+
+Writing xref:imap.adoc[IMAP extensions].
+
+The link:https://github.com/apache/james-project/tree/master/examples[examples] are also a good reference.
+
+== Handling injections for your extensions
+
+=== Injecting core components
+
+You can very easily inject core components into your custom extensions.
+
+All you need is to pass them via a constructor annotated via *@Inject*.
+
+For instance:
+
+....
+public class MyMailet extends GenericMailet {
+ private final UsersRepository usersRepository;
+
+ @Inject
+ public MyMailet(UsersRepository usersRepository) {
+ this.usersRepository = usersRepository;
+ }
+
+ @Override
+ public void service(Mail mail) throws MessagingException {
+ // Do something
+ }
+}
+....
+
+=== Injecting simple extension components
+
+Furthermore, concrete implementation, that are part of your extension, can be injected as well.
+
+Consider the following example:
+
+....
+
+public class MyService {
+
+}
+
+public class MyMailet extends GenericMailet {
+ private final MyService myService;
+
+ @Inject
+ public MyMailet(MyService myService) {
+ this.usersRepository = myService;
+ }
+
+ @Override
+ public void service(Mail mail) throws MessagingException {
+ // Do something
+ }
+}
+....
+
+=== Defining custom injections for your extensions
+
+However, to inject an interface into your extension, you will need additional injection definitions.
+
+To so:
+
+ * 1. Given an interface defined in an additional JAR:
+
+....
+public interface MyService {}
+....
+
+ * 2. And an implementation of that interface, in another additional JAR:
+
+....
+public class MyServiceImpl extends MyService {}
+....
+
+ * 3. We need to define a binding for MyService to be bound to MyServiceImpl
+
+....
+public class MyServiceModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(MyServiceImpl.class).in(Scopes.SINGLETON);
+ bind(MyService.class).to(MyServiceImpl.class);
+ }
+}
+....
+
+Both *MyService*, *MyServiceImpl* and *MyServiceModule* needs to be in the *extensions-jars*
+folder (potentially different jars).
+
+ * 4. *MyServiceModule* needs to be registered in xref:distributed/configure/extensions.adoc[*extensions.properties*]
+
+ * 5. *MyService* can then be used as part of your extensions
+
+....
+public class MyMailet extends GenericMailet {
+ private final MyService myService;
+
+ @Inject
+ public MyMailet(MyService myService) {
+ this.usersRepository = myService;
+ }
+
+ @Override
+ public void service(Mail mail) throws MessagingException {
+ // Do something
+ }
+}
+....
+
+Note that overriding injection definitions of the Distributed Server for your injections is not supported.
+
+=== Starting your components
+
+Sometimes you wish to 'start' your extensions. This can be achieved through defining your own `UserDefinedStartable`:
+
+```
+public class MyStartable implements UserDefinedStartable {
+ @Override
+ public void start() {
+ // Will be called
+ }
+}
+```
+
+Your startable then needs to be registered within `extensions.properties`:
+
+```
+guice.extension.startable=com.company.MyStartable
+```
+
+== Pre-packaged extensions
+
+=== Rate Limiting for mailet processing
+
+*Vendor*: Apache Foundation (James project), Apache License V2
+
+link:https://github.com/apache/james-project/tree/master/server/mailet/rate-limiter[Project link] contains detailed set
+up instructions and configuration examples as well as a pre-configured docker-compose.
+
+This extension ships mailets for applying advanced rate limit criteria to the email transiting through your James server.
+It is shipped with two backends implemented:
+
+ - *in memory*: For single server mode.
+ - *Redis*: Uses link:https://redis.io/[Redis] as a shared, fast and scalable in-memory datastore, allowing to apply rate
+ limiting in a distributed fashion. Here is the link:https://github.com/apache/james-project/tree/master/server/mailet/rate-limiter[link] to the Redis extension for rate limiting.
+ - Alternative extensions can be written and loaded into James using the xref:index.adoc#_handling_injections_for_your_extensions[Guice extension mechanism]
+ and providing custom injections for the `RateLimiterFactoryProvider` class.
+
+This extension ships the following mailets:
+
+- `PerSenderRateLimit` allows defining limits applied to the senders of emails (count of email, count of recipients,
+size, size * recipients)
+- `PerRecipientRateLimit` allows defining limits applied to the recipients of emails (count of email, size)
+- `GlobalRateLimit` allows defining limits applied to all the emails (count of email, count of recipients,
+size, size * recipients)
+
+Depending on their positions and the matcher they are being combined with, those rate limiting rules could be applied to
+submitted emails, received emails or emitted email being relayed to third parties.
+
+==== Throttling
+Can use combine with `Requeue` mailet for a throttler by re-enqueue mail.
+link:https://github.com/apache/james-project/tree/master/server/mailet/rate-limiter#throttling[link]
diff --git a/docs/modules/servers/pages/distributed/extending/mail-processing.adoc b/docs/modules/customization/pages/mail-processing.adoc
similarity index 98%
rename from docs/modules/servers/pages/distributed/extending/mail-processing.adoc
rename to docs/modules/customization/pages/mail-processing.adoc
index 0dc310232c..0dd0b76340 100644
--- a/docs/modules/servers/pages/distributed/extending/mail-processing.adoc
+++ b/docs/modules/customization/pages/mail-processing.adoc
@@ -1,4 +1,4 @@
-= Distributed James Server — Custom mail processing components
+= Custom mail processing components
:navtitle: Custom mail processing components
When none of the matchers and mailets available in James allows us to implement what we want, extension
diff --git a/docs/modules/servers/pages/distributed/extending/mailbox-listeners.adoc b/docs/modules/customization/pages/mailbox-listeners.adoc
similarity index 90%
rename from docs/modules/servers/pages/distributed/extending/mailbox-listeners.adoc
rename to docs/modules/customization/pages/mailbox-listeners.adoc
index e8cfd1dcc7..d48f6243db 100644
--- a/docs/modules/servers/pages/distributed/extending/mailbox-listeners.adoc
+++ b/docs/modules/customization/pages/mailbox-listeners.adoc
@@ -1,4 +1,4 @@
-= Distributed James Server — Custom Mailbox Listeners
+= Custom Mailbox Listeners
:navtitle: Custom Mailbox Listeners
== Writing additional listener
@@ -35,7 +35,7 @@ handled events and can save some IOs.
Your custom additional listener needs to be in the *extensions-jars* folder.
-You need to register its fully qualified class name in xref:distributed/configure/listeners.adoc[listeners.xml]
+You need to register its fully qualified class name in xref:listeners.adoc[listeners.xml]
== Events
@@ -54,4 +54,4 @@ mailboxes event (Added & Expunged) will be emitted as well.
== Example
-http://james.apache.org/howTo/custom-listeners.html[This page] provides a working example for writing additional custom mailbox listeners.
\ No newline at end of file
+http://james.apache.org/howTo/custom-listeners.html[This page] provides a working example for writing additional custom mailbox listeners.
diff --git a/docs/modules/servers/pages/distributed/extending/smtp-hooks.adoc b/docs/modules/customization/pages/smtp-hooks.adoc
similarity index 90%
rename from docs/modules/servers/pages/distributed/extending/smtp-hooks.adoc
rename to docs/modules/customization/pages/smtp-hooks.adoc
index 76cce66cbd..e66ab3e56e 100644
--- a/docs/modules/servers/pages/distributed/extending/smtp-hooks.adoc
+++ b/docs/modules/customization/pages/smtp-hooks.adoc
@@ -1,4 +1,4 @@
-= Distributed James Server — Custom SMTP hooks
+= Custom SMTP hooks
:navtitle: Custom SMTP hooks
SMTP hooks enable extending capabilities of the SMTP server and are run synchronously upon email reception, before the email is
@@ -53,7 +53,7 @@ The following interfaces allows interacting with the following commands:
== Custom hook registration
-Register you hooks using xref:distributed/configure/smtp.adoc[*smtpserver.xml*] handlerchain property.
+Register you hooks using xref:smtp.adoc[*smtpserver.xml*] handlerchain property.
== Writing additional SMTP commands
@@ -63,4 +63,4 @@ You want for example to write a code which handles a new command like "YOURCOOLC
For this kind of needs you should implement the CommandHandler interface. This gives you a lower-level API
to handle this kind of tasks. If you want to support a custom Hook in your CommandHandler its the best to
-just extend AbstractHookableCmdHandler.
\ No newline at end of file
+just extend AbstractHookableCmdHandler.
diff --git a/docs/modules/servers/pages/distributed/extending/webadmin-routes.adoc b/docs/modules/customization/pages/webadmin-routes.adoc
similarity index 79%
rename from docs/modules/servers/pages/distributed/extending/webadmin-routes.adoc
rename to docs/modules/customization/pages/webadmin-routes.adoc
index d06a0af872..e48c659008 100644
--- a/docs/modules/servers/pages/distributed/extending/webadmin-routes.adoc
+++ b/docs/modules/customization/pages/webadmin-routes.adoc
@@ -1,4 +1,4 @@
-= Distributed James Server — Custom WebAdmin routes
+= Custom WebAdmin routes
:navtitle: Custom WebAdmin routes
== Writing custom WebAdmin routes
@@ -35,5 +35,5 @@ public interface Routes {
Your custom WebAdmin routes needs to be in the *extensions-jars* folder.
-You need to register its fully qualified class name in xref:distributed/configure/webadmin.adoc[webadmin.properties]
-using the *extensions.routes* property.
\ No newline at end of file
+You need to register its fully qualified class name in xref:webadmin.adoc[webadmin.properties]
+using the *extensions.routes* property.
diff --git a/docs/modules/servers/nav.adoc b/docs/modules/servers/nav.adoc
index 4931020092..7fdb1f8bc1 100644
--- a/docs/modules/servers/nav.adoc
+++ b/docs/modules/servers/nav.adoc
@@ -73,12 +73,7 @@
**** xref:distributed/operate/cli.adoc[]
**** xref:distributed/operate/cassandra-migration.adoc[]
**** xref:distributed/operate/security.adoc[]
-*** xref:distributed/extending/index.adoc[]
-**** xref:distributed/extending/mail-processing.adoc[]
-**** xref:distributed/extending/mailbox-listeners.adoc[]
-**** xref:distributed/extending/smtp-hooks.adoc[]
-**** xref:distributed/extending/webadmin-routes.adoc[]
-**** xref:distributed/extending/imap.adoc[]
+*** xref:distributed/extending.adoc[]
*** xref:distributed/benchmark/index.adoc[Performance benchmark]
**** xref:distributed/benchmark/db-benchmark.adoc[]
**** xref:distributed/benchmark/james-benchmark.adoc[]
diff --git a/docs/modules/servers/pages/distributed/configure/extensions.adoc b/docs/modules/servers/pages/distributed/configure/extensions.adoc
index 876fb5cd84..a2b496a445 100644
--- a/docs/modules/servers/pages/distributed/configure/extensions.adoc
+++ b/docs/modules/servers/pages/distributed/configure/extensions.adoc
@@ -58,4 +58,4 @@ Recording it in extensions.properties :
guice.extension.tasks=com.project.RspamdTaskExtensionModule
....
-Read xref:distributed/extending/index.adoc#_defining_custom_injections_for_your_extensions[this page] for more details.
\ No newline at end of file
+Read xref:customization:index.adoc#_defining_custom_injections_for_your_extensions[this page] for more details.
diff --git a/docs/modules/servers/pages/distributed/configure/imap.adoc b/docs/modules/servers/pages/distributed/configure/imap.adoc
index 0060bcaf5b..96ac8c43af 100644
--- a/docs/modules/servers/pages/distributed/configure/imap.adoc
+++ b/docs/modules/servers/pages/distributed/configure/imap.adoc
@@ -156,7 +156,7 @@ It uses the Keycloak OIDC provider, but usage of similar technologies is definit
== Extending IMAP
-IMAP decoders, processors and encoder can be customized. xref:distributed/extending/imap.adoc[Read more].
+IMAP decoders, processors and encoder can be customized. xref:customization:imap.adoc[Read more].
Check this link:https://github.com/apache/james-project/tree/master/examples/custom-imap[example].
diff --git a/docs/modules/servers/pages/distributed/configure/mailetcontainer.adoc b/docs/modules/servers/pages/distributed/configure/mailetcontainer.adoc
index 8bac9254ff..f9e1722d7f 100644
--- a/docs/modules/servers/pages/distributed/configure/mailetcontainer.adoc
+++ b/docs/modules/servers/pages/distributed/configure/mailetcontainer.adoc
@@ -10,7 +10,7 @@ xref:distributed/architecture/index.adoc#_mail_processing[the mailet container f
Apache James Server includes a number of xref:distributed/configure/mailets.adoc[Packaged Mailets] and
xref:distributed/configure/matchers.adoc[Packaged Matchers].
-Furthermore, you can write and use with James xref:distributed/extending/mail-processing.adoc[your own mailet and matchers].
+Furthermore, you can write and use with James xref:customization:mail-processing.adoc[your own mailet and matchers].
Consult this link:https://github.com/apache/james-project/blob/master/server/apps/distributed-app/sample-configuration/mailetcontainer.xml[example]
to get some examples and hints.
@@ -93,4 +93,4 @@ Here is a short example to illustrate this:
<onMailetException>deliveryError</onMailetException>
<onMatcherException>nomatch</onMatcherException>
</mailet>
-....
\ No newline at end of file
+....
diff --git a/docs/modules/servers/pages/distributed/configure/mailrepositorystore.adoc b/docs/modules/servers/pages/distributed/configure/mailrepositorystore.adoc
index 8208c1c948..b897530eac 100644
--- a/docs/modules/servers/pages/distributed/configure/mailrepositorystore.adoc
+++ b/docs/modules/servers/pages/distributed/configure/mailrepositorystore.adoc
@@ -10,7 +10,7 @@ For instance in the url `cassandra://var/mail/error/` `cassandra` is the protoco
The *mailrepositorystore.xml* file allows registration of available protocols, and their binding to actual MailRepository
implementation. Note that extension developers can write their own MailRepository implementations, load them via the
-`extensions-jars` mechanism as documented in xref:distributed/extending/index.adoc['writing your own extensions'], and finally
+`extensions-jars` mechanism as documented in xref:customization:index.adoc['writing your own extensions'], and finally
associated to a protocol in *mailrepositorystore.xml* for a usage in *mailetcontainer.xml*.
== Configuration
diff --git a/docs/modules/servers/pages/distributed/configure/webadmin.adoc b/docs/modules/servers/pages/distributed/configure/webadmin.adoc
index 01477845c3..767f4fca47 100644
--- a/docs/modules/servers/pages/distributed/configure/webadmin.adoc
+++ b/docs/modules/servers/pages/distributed/configure/webadmin.adoc
@@ -61,7 +61,7 @@ Defaults to the `jwt.publickeypem.url` value of `jmap.properties` file if unspec
| extensions.routes
| List of Routes specified as fully qualified class name that should be loaded in addition to your product routes list. Routes
needs to be on the classpath or in the ./extensions-jars folder. Read mode about
-xref:distributed/extending/webadmin-routes.adoc[creating you own webadmin routes].
+xref:customization:webadmin-routes.adoc[creating you own webadmin routes].
| maxThreadCount
| Maximum threads used by the underlying Jetty server. Optional.
@@ -97,4 +97,4 @@ The public key can be referenced as `jwt.publickeypem.url` of the `jmap.properti
WebAdmin adds the value of `X-Real-IP` header as part of the logging MDC.
-This allows for reverse proxies to cary other the IP address of the client down to the JMAP server for diagnostic purpose.
\ No newline at end of file
+This allows for reverse proxies to cary other the IP address of the client down to the JMAP server for diagnostic purpose.
diff --git a/docs/modules/servers/pages/distributed/extending.adoc b/docs/modules/servers/pages/distributed/extending.adoc
new file mode 100644
index 0000000000..bf94fc0498
--- /dev/null
+++ b/docs/modules/servers/pages/distributed/extending.adoc
@@ -0,0 +1,4 @@
+= Distributed James Server — Extending behaviour
+:navtitle: Extending behaviour
+
+This section can be read xref:customization:index.adoc[this page].
diff --git a/docs/modules/servers/pages/distributed/extending/index.adoc b/docs/modules/servers/pages/distributed/extending/index.adoc
deleted file mode 100644
index 79805ffa6e..0000000000
--- a/docs/modules/servers/pages/distributed/extending/index.adoc
+++ /dev/null
@@ -1,187 +0,0 @@
-= Distributed James Server — Extending server behavior
-:navtitle: Extending server behavior
-
-== Available extension mechanisms
-
-image::james-hexagons-extensions.png[Extension mechanisms for the Distributed Server]
-
-The Distributed Server exposes several interfaces allowing the user to write custom extensions in
-order to extend the Distributed Server behavior.
-
-Writing *Mailets* and *Matchers* allows one to supply custom components for the
-xref:distributed/extending/mail-processing.adoc[Mail Processing] and
-enables to take decisions, and implement your business logic at the transport level.
-
-Writing xref:distributed/extending/mailbox-listeners.adoc[Mailbox listeners] enables to
-react to your user interaction with their mailbox. This powerful tool allows build advanced features
-for mail delivery servers.
-
-Writing xref:distributed/extending/smtp-hooks.adoc[SMTP hookd] enables to
-add features to your SMTP server.
-
-Writing xref:distributed/extending/webadmin-routes.adoc[WebAdmin routes] enables to
-add features to the WebAdmin REST API.
-
-Writing xref:distributed/extending/imap.adoc[IMAP extensions].
-
-The link:https://github.com/apache/james-project/tree/master/examples[examples] are also a good reference.
-
-== Handling injections for your extensions
-
-=== Injecting core components
-
-You can very easily inject core components into your custom extensions.
-
-All you need is to pass them via a constructor annotated via *@Inject*.
-
-For instance:
-
-....
-public class MyMailet extends GenericMailet {
- private final UsersRepository usersRepository;
-
- @Inject
- public MyMailet(UsersRepository usersRepository) {
- this.usersRepository = usersRepository;
- }
-
- @Override
- public void service(Mail mail) throws MessagingException {
- // Do something
- }
-}
-....
-
-=== Injecting simple extension components
-
-Furthermore, concrete implementation, that are part of your extension, can be injected as well.
-
-Consider the following example:
-
-....
-
-public class MyService {
-
-}
-
-public class MyMailet extends GenericMailet {
- private final MyService myService;
-
- @Inject
- public MyMailet(MyService myService) {
- this.usersRepository = myService;
- }
-
- @Override
- public void service(Mail mail) throws MessagingException {
- // Do something
- }
-}
-....
-
-=== Defining custom injections for your extensions
-
-However, to inject an interface into your extension, you will need additional injection definitions.
-
-To so:
-
- * 1. Given an interface defined in an additional JAR:
-
-....
-public interface MyService {}
-....
-
- * 2. And an implementation of that interface, in another additional JAR:
-
-....
-public class MyServiceImpl extends MyService {}
-....
-
- * 3. We need to define a binding for MyService to be bound to MyServiceImpl
-
-....
-public class MyServiceModule extends AbstractModule {
- @Override
- protected void configure() {
- bind(MyServiceImpl.class).in(Scopes.SINGLETON);
- bind(MyService.class).to(MyServiceImpl.class);
- }
-}
-....
-
-Both *MyService*, *MyServiceImpl* and *MyServiceModule* needs to be in the *extensions-jars*
-folder (potentially different jars).
-
- * 4. *MyServiceModule* needs to be registered in xref:distributed/configure/extensions.adoc[*extensions.properties*]
-
- * 5. *MyService* can then be used as part of your extensions
-
-....
-public class MyMailet extends GenericMailet {
- private final MyService myService;
-
- @Inject
- public MyMailet(MyService myService) {
- this.usersRepository = myService;
- }
-
- @Override
- public void service(Mail mail) throws MessagingException {
- // Do something
- }
-}
-....
-
-Note that overriding injection definitions of the Distributed Server for your injections is not supported.
-
-=== Starting your components
-
-Sometimes you wish to 'start' your extensions. This can be achieved through defining your own `UserDefinedStartable`:
-
-```
-public class MyStartable implements UserDefinedStartable {
- @Override
- public void start() {
- // Will be called
- }
-}
-```
-
-Your startable then needs to be registered within `extensions.properties`:
-
-```
-guice.extension.startable=com.company.MyStartable
-```
-
-== Pre-packaged extensions
-
-=== Rate Limiting for mailet processing
-
-*Vendor*: Apache Foundation (James project), Apache License V2
-
-link:https://github.com/apache/james-project/tree/master/server/mailet/rate-limiter[Project link] contains detailed set
-up instructions and configuration examples as well as a pre-configured docker-compose.
-
-This extension ships mailets for applying advanced rate limit criteria to the email transiting through your James server.
-It is shipped with two backends implemented:
-
- - *in memory*: For single server mode.
- - *Redis*: Uses link:https://redis.io/[Redis] as a shared, fast and scalable in-memory datastore, allowing to apply rate
- limiting in a distributed fashion. Here is the link:https://github.com/apache/james-project/tree/master/server/mailet/rate-limiter[link] to the Redis extension for rate limiting.
- - Alternative extensions can be written and loaded into James using the xref:distributed/extending/index.adoc#_handling_injections_for_your_extensions[Guice extension mechanism]
- and providing custom injections for the `RateLimiterFactoryProvider` class.
-
-This extension ships the following mailets:
-
-- `PerSenderRateLimit` allows defining limits applied to the senders of emails (count of email, count of recipients,
-size, size * recipients)
-- `PerRecipientRateLimit` allows defining limits applied to the recipients of emails (count of email, size)
-- `GlobalRateLimit` allows defining limits applied to all the emails (count of email, count of recipients,
-size, size * recipients)
-
-Depending on their positions and the matcher they are being combined with, those rate limiting rules could be applied to
-submitted emails, received emails or emitted email being relayed to third parties.
-
-==== Throttling
-Can use combine with `Requeue` mailet for a throttler by re-enqueue mail.
-link:https://github.com/apache/james-project/tree/master/server/mailet/rate-limiter#throttling[link]
diff --git a/docs/modules/servers/pages/distributed/index.adoc b/docs/modules/servers/pages/distributed/index.adoc
index 1e65a3ecab..29607568cf 100644
--- a/docs/modules/servers/pages/distributed/index.adoc
+++ b/docs/modules/servers/pages/distributed/index.adoc
@@ -22,5 +22,5 @@ In this section of the documentation, we will introduce you to:
* xref:distributed/run/index.adoc[Run the Distributed Server]
* xref:distributed/configure/index.adoc[Configure the Distributed Server]
* xref:distributed/operate/index.adoc[Operation of the Distributed Server]
-* xref:distributed/extending/index.adoc[How to extend the server]
+* xref:customization:index.adoc[How to extend the server]
diff --git a/docs/modules/servers/pages/distributed/objectives.adoc b/docs/modules/servers/pages/distributed/objectives.adoc
index 327778c65c..d383cdde16 100644
--- a/docs/modules/servers/pages/distributed/objectives.adoc
+++ b/docs/modules/servers/pages/distributed/objectives.adoc
@@ -27,5 +27,5 @@ databases.
Furthermore, this server is intended to be easily customisable so that it can easily be adapted to ones needs.
* Several packaged extensions can be xref:distributed/configure/index.adoc#_for_extensions[configured]
-* It is easy to write and load xref:distributed/extending/index.adoc[your own extensions]
+* It is easy to write and load xref:customization:index.adoc[your own extensions]
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org