since v12.20
This extension point allows you to implement messenger retrieval from external messaging sources into novomind iAGENT as well as the delivery of answers back to the original source.
Please annotate your implementation of MessengerConnector with the runtime annotation MessengerConnectorPlugin.
Example:
@MessengerConnectorPlugin(protocol = "example_protocol",
customChatChannels = {
@CustomChatChannel(
name = "example_chat_channel",
displayName = "example_chat_channel",
format = HTML,
formatElements = {
BOLD,
ITALIC,
STRIKETHROUGH
}
)
})
public class ExampleMessengerConnector implements MessengerConnector {
// To be implemented
}
There will be an instance of your implementation of MessengerConnector created for each configured MessengerAccount.
During startup or when activating a MessengerAccount the init
method of the instance of your MessengerConnector implementation will be called.
@Override
public void init(final MessengerAccount account, final MessengerConnectorEventListener listener, final Logger logger) {
// To be implemented
}
As method parameters you will be passed the MessengerAccount for which this instance is running for, an instance of a MessengerConnectorEventListener which you can pass incoming messenger messages to and a logger to direct all log messages to.
New incoming messenger messages need to be passed to the provided instance of MessengerConnectorEventListener. Depending on the type of the incoming message the appropriate method of the MessengerConnectorEventListener needs to be called.
The method messageReceivedSuccessful
of your MessengerConnector will be called after successful message retrieval. A call to messageReceivedFailed
will indicate a failure during message retrieval.
novomind iAGENT will call the appropriate send..
method of the instance of your implementation of MessengerConnector to indicate the outgoing sending of a messenger message.
You can indicate a successful sending with a call to the messengerSentMessage
of the provided MessengerConnectorEventListener. Call messengerSendMessageFailed
to indicate a failure during the sending of the messenger message.
During system shutdown or when deactivating a MessengerAccount the release
method of the instance of your MessengerConnector implementation will be called.
@Override
public void release() {
// To be implemented
}
It is vital that you close all open network connections and release all potentially used resources. Do not pass any incoming messages to theMessengerConnectorEventListener after the release
method has been called.