Interface MessageConnector<T>
- All Superinterfaces:
Iterable<T>
- All Known Subinterfaces:
ExtendedMessageConnector
,SimpleMessageConnector
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 TypeMethodDescriptionvoid
The method is called after an instance of the MessageConnector has been instantiated.iterator()
As long as theMessageConnector
is running this method will be called periodically to retrieve messages from an external source.void
release()
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
The method is called after an instance of the MessageConnector has been instantiated.- Parameters:
account
- the account that is running thisMessageConnector
logger
- the logger of the account running theMessageConnector
- 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 theMessageConnector
is running this method will be called periodically to retrieve messages from an external source. TheMessageIterator
may not be iterated until it's end. TheMessageIterator
has to implement theMessageIterator.remove()
method, that will be called to remove a message permanently from the source after being processed successfully. Finally theMessageIterator.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. -
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 theAnswerType.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 theAnswerType.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
-