[
https://issues.apache.org/jira/browse/JAMES-3910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benoit Tellier updated JAMES-3910:
----------------------------------
Description:
h3. Why?
It is common to group mailets related to a "feature" into a portion of a
"processor".
For instance the notorious ICAL pipeline:
{code:xml}
<processor state="local-recipient" enableJmx="true">
<!-- ICAL pipeline -->
<mailet match="All" class="RemoveMimeHeader">
<name>X-MEETING-UID,X-MEETING-METHOD,X-MEETING-RECURRENCE-ID,X-MEETING-SEQUENCE,X-MEETING-DTSTAMP</name>
<onMailetException>ignore</onMailetException>
</mailet>
<mailet match="All" class="StripAttachment">
<mimeType>text/calendar</mimeType>
<attribute>rawIcalendar</attribute>
</mailet>
<mailet match="All" class="MimeDecodingMailet">
<attribute>rawIcalendar</attribute>
</mailet>
<mailet match="All" class="ICalendarParser">
<sourceAttribute>rawIcalendar</sourceAttribute>
<destinationAttribute>icalendar</destinationAttribute>
</mailet>
<mailet match="All" class="ICALToHeader">
<attribute>icalendar</attribute>
</mailet>
<mailet match="All" class="ICALToJsonAttribute">
<source>icalendar</source>
<destination>icalendarAsJson</destination>
<rawSource>rawIcalendar</rawSource>
</mailet>
<mailet match="All" class="AmqpForwardAttribute">
<uri>amqp://${env:OP_JAMES_AMQP_USERNAME}:${env:OP_JAMES_AMQP_PASSWORD}@${env:OP_JAMES_AMQP_HOST}:${env:OP_JAMES_AMQP_PORT}</uri>
<exchange>james:events</exchange>
<attribute>icalendarAsJson</attribute>
</mailet>
<!-- End of ICAL pipeline -->
<mailet match="All" class="AddDeliveredToHeader"/>
<mailet match="All" class="LocalDelivery"/>
</processor>
{code}
In more complex example this can become complex to read.
It would be easier to have the ICAL pipeline in a dedicated processor, but this
is not doable as ToProcessor acts as a "goto".
h3. Proposal
Add an **include** tag, that puts in place all mailets from the mentionned
processor.
It then become possible to extract the ICAL pipeline to a dedicated processor,
get rid of extra comments, reuse it in various portion of the mailet
container...
Eg
{code:java}
<processor state="local-recipient" enableJmx="true">
<include processor="ical"/>
<mailet match="All" class="AddDeliveredToHeader"/>
<mailet match="All" class="LocalDelivery"/>
</processor>
<processor state="ical" enableJmx="true">
<mailet match="All" class="RemoveMimeHeader">
<name>X-MEETING-UID,X-MEETING-METHOD,X-MEETING-RECURRENCE-ID,X-MEETING-SEQUENCE,X-MEETING-DTSTAMP</name>
<onMailetException>ignore</onMailetException>
</mailet>
<mailet match="All" class="StripAttachment">
<mimeType>text/calendar</mimeType>
<attribute>rawIcalendar</attribute>
</mailet>
<mailet match="All" class="MimeDecodingMailet">
<attribute>rawIcalendar</attribute>
</mailet>
<mailet match="All" class="ICalendarParser">
<sourceAttribute>rawIcalendar</sourceAttribute>
<destinationAttribute>icalendar</destinationAttribute>
</mailet>
<mailet match="All" class="ICALToHeader">
<attribute>icalendar</attribute>
</mailet>
<mailet match="All" class="ICALToJsonAttribute">
<source>icalendar</source>
<destination>icalendarAsJson</destination>
<rawSource>rawIcalendar</rawSource>
</mailet>
<mailet match="All" class="AmqpForwardAttribute">
<uri>amqp://${env:OP_JAMES_AMQP_USERNAME}:${env:OP_JAMES_AMQP_PASSWORD}@${env:OP_JAMES_AMQP_HOST}:${env:OP_JAMES_AMQP_PORT}</uri>
<exchange>james:events</exchange>
<attribute>icalendarAsJson</attribute>
</mailet>
</processor>
{code}
Standards tools will offer better folding, better indent, etc... Reuse becomes
possible.
was:
h3. Why?
It is common to group mailets related to a "feature" into a portion of a
"processor".
For instance the notorious ICAL pipeline:
{code:xml}
<processor state="local-recipient" enableJmx="true">
<!-- ICAL pipeline -->
<mailet match="All" class="RemoveMimeHeader">
<name>X-MEETING-UID,X-MEETING-METHOD,X-MEETING-RECURRENCE-ID,X-MEETING-SEQUENCE,X-MEETING-DTSTAMP</name>
<onMailetException>ignore</onMailetException>
</mailet>
<mailet match="All" class="StripAttachment">
<mimeType>text/calendar</mimeType>
<attribute>rawIcalendar</attribute>
</mailet>
<mailet match="All" class="MimeDecodingMailet">
<attribute>rawIcalendar</attribute>
</mailet>
<mailet match="All" class="ICalendarParser">
<sourceAttribute>rawIcalendar</sourceAttribute>
<destinationAttribute>icalendar</destinationAttribute>
</mailet>
<mailet match="All" class="ICALToHeader">
<attribute>icalendar</attribute>
</mailet>
<mailet match="All" class="ICALToJsonAttribute">
<source>icalendar</source>
<destination>icalendarAsJson</destination>
<rawSource>rawIcalendar</rawSource>
</mailet>
<mailet match="All" class="AmqpForwardAttribute">
<uri>amqp://${env:OP_JAMES_AMQP_USERNAME}:${env:OP_JAMES_AMQP_PASSWORD}@${env:OP_JAMES_AMQP_HOST}:${env:OP_JAMES_AMQP_PORT}</uri>
<exchange>james:events</exchange>
<attribute>icalendarAsJson</attribute>
</mailet>
<!-- End of ICAL pipeline -->
<mailet match="All" class="AddDeliveredToHeader"/>
<mailet match="All" class="LocalDelivery"/>
</processor>
{code}
In more complex example this can become complex to read.
It would be easier to have the ICAL pipeline in a dedicated processor, but this
is not doable as ToProcessor acts as a "goto".
h3. Proposal
Add an **include** tag, that puts in place all mailets from the mentionned
processor.
It then become possible to extract the ICAL pipeline to a dedicated processor,
get rid of extra comments, reuse it in various portion of the mailet
container...
Eg
{code:java}
<processor state="local-recipient" enableJmx="true">
<include processor="ical"/>
<mailet match="All" class="AddDeliveredToHeader"/>
<mailet match="All" class="LocalDelivery"/>
</processor>
<processor state="ical" enableJmx="true">
<mailet match="All" class="RemoveMimeHeader">
<name>X-MEETING-UID,X-MEETING-METHOD,X-MEETING-RECURRENCE-ID,X-MEETING-SEQUENCE,X-MEETING-DTSTAMP</name>
<onMailetException>ignore</onMailetException>
</mailet>
<mailet match="All" class="StripAttachment">
<mimeType>text/calendar</mimeType>
<attribute>rawIcalendar</attribute>
</mailet>
<mailet match="All" class="MimeDecodingMailet">
<attribute>rawIcalendar</attribute>
</mailet>
<mailet match="All" class="ICalendarParser">
<sourceAttribute>rawIcalendar</sourceAttribute>
<destinationAttribute>icalendar</destinationAttribute>
</mailet>
<mailet match="All" class="ICALToHeader">
<attribute>icalendar</attribute>
</mailet>
<mailet match="All" class="ICALToJsonAttribute">
<source>icalendar</source>
<destination>icalendarAsJson</destination>
<rawSource>rawIcalendar</rawSource>
</mailet>
<mailet match="All" class="AmqpForwardAttribute">
<uri>amqp://${env:OP_JAMES_AMQP_USERNAME}:${env:OP_JAMES_AMQP_PASSWORD}@${env:OP_JAMES_AMQP_HOST}:${env:OP_JAMES_AMQP_PORT}</uri>
<exchange>james:events</exchange>
<attribute>icalendarAsJson</attribute>
</mailet>
</processor>
{code}
Standards too will offer better folding, better indent, etc... Reuse becomes
possible.
> More expressive mailetcontainer with include directive?
> -------------------------------------------------------
>
> Key: JAMES-3910
> URL: https://issues.apache.org/jira/browse/JAMES-3910
> Project: James Server
> Issue Type: Improvement
> Components: Mailet Contributions
> Reporter: Benoit Tellier
> Priority: Major
> Labels: discussion
>
> h3. Why?
> It is common to group mailets related to a "feature" into a portion of a
> "processor".
> For instance the notorious ICAL pipeline:
> {code:xml}
> <processor state="local-recipient" enableJmx="true">
> <!-- ICAL pipeline -->
> <mailet match="All" class="RemoveMimeHeader">
>
> <name>X-MEETING-UID,X-MEETING-METHOD,X-MEETING-RECURRENCE-ID,X-MEETING-SEQUENCE,X-MEETING-DTSTAMP</name>
> <onMailetException>ignore</onMailetException>
> </mailet>
> <mailet match="All" class="StripAttachment">
> <mimeType>text/calendar</mimeType>
> <attribute>rawIcalendar</attribute>
> </mailet>
> <mailet match="All" class="MimeDecodingMailet">
> <attribute>rawIcalendar</attribute>
> </mailet>
> <mailet match="All" class="ICalendarParser">
> <sourceAttribute>rawIcalendar</sourceAttribute>
> <destinationAttribute>icalendar</destinationAttribute>
> </mailet>
> <mailet match="All" class="ICALToHeader">
> <attribute>icalendar</attribute>
> </mailet>
> <mailet match="All" class="ICALToJsonAttribute">
> <source>icalendar</source>
> <destination>icalendarAsJson</destination>
> <rawSource>rawIcalendar</rawSource>
> </mailet>
> <mailet match="All" class="AmqpForwardAttribute">
>
> <uri>amqp://${env:OP_JAMES_AMQP_USERNAME}:${env:OP_JAMES_AMQP_PASSWORD}@${env:OP_JAMES_AMQP_HOST}:${env:OP_JAMES_AMQP_PORT}</uri>
> <exchange>james:events</exchange>
> <attribute>icalendarAsJson</attribute>
> </mailet>
> <!-- End of ICAL pipeline -->
> <mailet match="All" class="AddDeliveredToHeader"/>
> <mailet match="All" class="LocalDelivery"/>
> </processor>
> {code}
> In more complex example this can become complex to read.
> It would be easier to have the ICAL pipeline in a dedicated processor, but
> this is not doable as ToProcessor acts as a "goto".
> h3. Proposal
> Add an **include** tag, that puts in place all mailets from the mentionned
> processor.
> It then become possible to extract the ICAL pipeline to a dedicated
> processor, get rid of extra comments, reuse it in various portion of the
> mailet container...
> Eg
> {code:java}
> <processor state="local-recipient" enableJmx="true">
> <include processor="ical"/>
>
> <mailet match="All" class="AddDeliveredToHeader"/>
> <mailet match="All" class="LocalDelivery"/>
> </processor>
> <processor state="ical" enableJmx="true">
> <mailet match="All" class="RemoveMimeHeader">
>
> <name>X-MEETING-UID,X-MEETING-METHOD,X-MEETING-RECURRENCE-ID,X-MEETING-SEQUENCE,X-MEETING-DTSTAMP</name>
> <onMailetException>ignore</onMailetException>
> </mailet>
> <mailet match="All" class="StripAttachment">
> <mimeType>text/calendar</mimeType>
> <attribute>rawIcalendar</attribute>
> </mailet>
> <mailet match="All" class="MimeDecodingMailet">
> <attribute>rawIcalendar</attribute>
> </mailet>
> <mailet match="All" class="ICalendarParser">
> <sourceAttribute>rawIcalendar</sourceAttribute>
> <destinationAttribute>icalendar</destinationAttribute>
> </mailet>
> <mailet match="All" class="ICALToHeader">
> <attribute>icalendar</attribute>
> </mailet>
> <mailet match="All" class="ICALToJsonAttribute">
> <source>icalendar</source>
> <destination>icalendarAsJson</destination>
> <rawSource>rawIcalendar</rawSource>
> </mailet>
> <mailet match="All" class="AmqpForwardAttribute">
>
> <uri>amqp://${env:OP_JAMES_AMQP_USERNAME}:${env:OP_JAMES_AMQP_PASSWORD}@${env:OP_JAMES_AMQP_HOST}:${env:OP_JAMES_AMQP_PORT}</uri>
> <exchange>james:events</exchange>
> <attribute>icalendarAsJson</attribute>
> </mailet>
> </processor>
> {code}
> Standards tools will offer better folding, better indent, etc... Reuse
> becomes possible.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]