@PublicSpi
public interface MessageHandler
As of JIRA 5.0 MessageHandler implementations provided by plugins are created using dependency injection, so injecting your dependencies instead of calling them statically is the prefered way to go.
Modifier and Type | Method and Description |
---|---|
boolean |
handleMessage(javax.mail.Message message,
MessageHandlerContext context)
Perform the specific work of this handler for the given message.
|
void |
init(Map<String,String> params,
MessageHandlerErrorCollector errorCollector)
Will be called before any messages are to be handled.
|
void init(Map<String,String> params, MessageHandlerErrorCollector errorCollector)
params
- configuration.errorCollector
- potential problems encountered during initialization of the handler
should be reported here. Depending on the run mode it may be e.g. displayed back to the user (when handler
is tested from UI) or logged to the file .boolean handleMessage(javax.mail.Message message, MessageHandlerContext context) throws javax.mail.MessagingException
MessageHandlerExecutionMonitor.markMessageForDeletion(java.lang.String)
.
Calling this method will mark the message for deletion, but will also attempt to forward the email on to the admin
with the given error message if such a forwarding address has been configured.message
- the message to check for handling.context
- user-friendly message handler should utilize this interface
to create issue, comments, users and provide feedback information about messages being
processed and problems being encountered. While MessageHandler-s are run
from UI (in TEST / dry-run mode) such invocations are not mutative (they do not create any
JIRA entities) and information provided by the handler is displayed back to the user
as a summary of the dry-run.javax.mail.MessagingException
- if anything went wrong.Copyright © 2002-2015 Atlassian. All Rights Reserved.