Interface MessageConnector<T>

All Superinterfaces:
Iterable<T>
All Known Subinterfaces:
ExtendedMessageConnector, SimpleMessageConnector

public interface MessageConnector<T> extends Iterable<T>

This interface is an extension point to implement message retrieval from different sources to the iAGENT system and also the delivery of the messages back to the source, after the message has been answered by the iAGENT system.

Since:
10.0.46
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    init(Account account, org.slf4j.Logger logger)
    The method is called after an instance of the MessageConnector has been instantiated.
    As long as the MessageConnector is running this method will be called periodically to retrieve messages from an external source.
    void
    The method is called before an instance of the MessageConnector is being released or replaced by another e.g.
    jakarta.mail.Message
    sendMessage(jakarta.mail.Message preSendMessage, PreSendMessageInfo preSendMessageInfo, OutgoingMessageInfo outgoingMessageInfo, AnswerType answerType, Optional<Ticket> ticket)
    The method is called to send the message back to it's source or any other destination that can be addressed by this MessageConnector.

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • init

      void init(Account account, org.slf4j.Logger logger)
      The method is called after an instance of the MessageConnector has been instantiated.
      Parameters:
      account - the account that is running this MessageConnector
      logger - the logger of the account running the MessageConnector
      Since:
      10.0.46
    • release

      void release()
      The method is called before an instance of the MessageConnector is being released or replaced by another e.g. because of a change of account configuration or system shutdown.
      Since:
      10.0.46
    • iterator

      MessageIterator<T> iterator()
      As long as the MessageConnector is running this method will be called periodically to retrieve messages from an external source. The MessageIterator may not be iterated until it's end. The MessageIterator has to implement the MessageIterator.remove() method, that will be called to remove a message permanently from the source after being processed successfully. Finally the MessageIterator.close() method will be called to indicate the end of the iteration and therefore also the end of the iterator's life cycle. All further messages, that haven't been processed yet, will be processed during the next fetch period.
      Specified by:
      iterator in interface Iterable<T>
      Returns:
      a MessageIterator that allows to iterate the new mails waiting on the external source
      Since:
      10.0.46
    • sendMessage

      jakarta.mail.Message sendMessage(jakarta.mail.Message preSendMessage, PreSendMessageInfo preSendMessageInfo, OutgoingMessageInfo outgoingMessageInfo, AnswerType answerType, Optional<Ticket> ticket) throws PermanentMessagingException, TemporaryMessagingException
      The method is called to send the message back to it's source or any other destination that can be addressed by this MessageConnector.
      Parameters:
      preSendMessage - The message to be sent. This message may be manipulated e.g. by adding X-Header or change of subject etc.
      preSendMessageInfo - The preSendMessageInfo object provides additional information about the PreSendMessage object.
      outgoingMessageInfo - The outgoingMessageInfo object provides additional information about the message on the outgoing queue waiting to be sent.
      answerType - The AnswerType of the message specifies the type of operation. In most cases the AnswerType.DEFAULT indicates the sending of the final answer of a ticket. There are also other types of answer operations e.g. intermediate reply or confirmation messages, so the implementor always has to take care of the type of answer operation according to the specific requirement.
      ticket - The ticket associated with the message - please note that the ticket is optional. The ticket may be unavailable e.g. for the AnswerType.NOTIFICATION, if there is no ticket associated with the message to be send.
      Returns:
      the message that has been sent.
      Throws:
      PermanentMessagingException - Throw a PermanentMessagingException to indicate a permanent error. The message will be marked as send failure on the outgoing folder.
      TemporaryMessagingException - Throw a TemporaryMessagingException to indicate a temporary error. The message will stay on the outgoing folder to be sent again after a short period of time.
      Since:
      10.0.46