com.atlassian.jira.service.util.handler
Interface MessageHandler


@PublicSpi
public interface MessageHandler

An interface representing a message handler. A handler handles messages. Implementers may extend AbstractMessageHandler (provided by JIRA Mail Plugin) to inherit standard functionality such mail loop detection etc.

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.


Method Summary
 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.
 

Method Detail

init

void init(Map<String,String> params,
          MessageHandlerErrorCollector errorCollector)
Will be called before any messages are to be handled.

Parameters:
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 .

handleMessage

boolean handleMessage(javax.mail.Message message,
                      MessageHandlerContext context)
                      throws javax.mail.MessagingException
Perform the specific work of this handler for the given message.

Parameters:
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.
Returns:
true if the message is to be deleted from the source.
Throws:
javax.mail.MessagingException - if anything went wrong.


Copyright © 2002-2013 Atlassian. All Rights Reserved.