-
- All Implemented Interfaces:
public class BotRepositoryAdvanced bot configuration.
ai.tock.bot.registerAndInstallBot method is the preferred way to start a bot in most use cases.
-
-
Field Summary
Fields Modifier and Type Field Description private volatile RequestTimerrequestTimerprivate Function1<RoutingContext, Unit>healthcheckHandlerpublic final static BotRepositoryINSTANCE
-
Method Summary
Modifier and Type Method Description final UnitforEachNlpListener(Function1<NlpListener, Unit> action)Calls the specified action for each registered NlpListener. final Unitnotify(String applicationId, PlayerId recipientId, IntentAware intent, StoryStep<out StoryHandlerDefinition> step, Map<String, String> parameters, NotifyBotStateModifier stateModifier, ActionNotificationType notificationType, String namespace, String botId, Function1<Throwable, Unit> errorListener)Sends a notification to a connector. final UnitregisterBotProvider(BotProvider bot)Registers a new BotProvider. final UnitregisterBuiltInStoryDefinitions(BotProvider botProvider)Register built-in story definitions. final UnitregisterStoryHandlerListener(StoryHandlerListener listener)Registers a new StoryHandlerListener. final UnitregisterBotAnswerInterceptor(BotAnswerInterceptor botAnswerInterceptor)Registers a new BotAnswerInterceptor. final UnitregisterNlpListener(NlpListener listener)Registers a new NlpListener. final UnitregisterConnectorService(ConnectorService service)final UnitregisterDetailedHealtcheckTask(Pair<String, Function0<Boolean>> task)Register a new task to be check by the detailed healthcheck. final ConnectorControllergetController(Function1<BotApplicationConfiguration, Boolean> predicate)Returns the current ConnectorController for a given predicate. final UnitinstallBots(List<Function1<Router, Object>> routerHandlers, Boolean createApplicationIfNotExists, Lock startupLock)Installs the bot(s). final ConnectorProviderfindConnectorProvider(ConnectorType connectorType)Returns the ConnectorProvider for the specified ConnectorType. final UnitcheckBotConfigurations(Boolean startup, Boolean botConfigurationChanged)Checks that configurations are synchronized with the database. final RequestTimergetRequestTimer()Request timer for connectors. final UnitsetRequestTimer(RequestTimer requestTimer)Request timer for connectors. final Function1<RoutingContext, Unit>getHealthcheckHandler()final UnitsetHealthcheckHandler(Function1<RoutingContext, Unit> healthcheckHandler)-
-
Method Detail
-
forEachNlpListener
final Unit forEachNlpListener(Function1<NlpListener, Unit> action)
Calls the specified action for each registered NlpListener.
-
notify
@Deprecated(message = "use ai.tock.bot.definition.notify", replaceWith = @ReplaceWith(imports = {"ai.tock.bot.definition.notify"}, expression = "notify")) final Unit notify(String applicationId, PlayerId recipientId, IntentAware intent, StoryStep<out StoryHandlerDefinition> step, Map<String, String> parameters, NotifyBotStateModifier stateModifier, ActionNotificationType notificationType, String namespace, String botId, Function1<Throwable, Unit> errorListener)
Sends a notification to a connector. A Bus is created and the corresponding story is called.
- Parameters:
applicationId- the configuration connector idrecipientId- the recipient identifierintent- the notification intentstep- the optional step targetparameters- the optional parametersstateModifier- allow the notification to bypass current user statenotificationType- the notification type if anyerrorListener- called when a message has not been delivered
-
registerBotProvider
final Unit registerBotProvider(BotProvider bot)
Registers a new BotProvider.
-
registerBuiltInStoryDefinitions
final Unit registerBuiltInStoryDefinitions(BotProvider botProvider)
Register built-in story definitions.
-
registerStoryHandlerListener
final Unit registerStoryHandlerListener(StoryHandlerListener listener)
Registers a new StoryHandlerListener.
-
registerBotAnswerInterceptor
final Unit registerBotAnswerInterceptor(BotAnswerInterceptor botAnswerInterceptor)
Registers a new BotAnswerInterceptor.
-
registerNlpListener
final Unit registerNlpListener(NlpListener listener)
Registers a new NlpListener.
-
registerConnectorService
final Unit registerConnectorService(ConnectorService service)
-
registerDetailedHealtcheckTask
final Unit registerDetailedHealtcheckTask(Pair<String, Function0<Boolean>> task)
Register a new task to be check by the detailed healthcheck. A task as a name and check action that return true if the service is good and false if it's KO.
-
getController
final ConnectorController getController(Function1<BotApplicationConfiguration, Boolean> predicate)
Returns the current ConnectorController for a given predicate.
-
installBots
final Unit installBots(List<Function1<Router, Object>> routerHandlers, Boolean createApplicationIfNotExists, Lock startupLock)
Installs the bot(s).
- Parameters:
routerHandlers- the additional router handlerscreateApplicationIfNotExists- create an nlp application if not existsstartupLock- if not null, wait do listen until the lock is released
-
findConnectorProvider
final ConnectorProvider findConnectorProvider(ConnectorType connectorType)
Returns the ConnectorProvider for the specified ConnectorType.
-
checkBotConfigurations
@Synchronized() final Unit checkBotConfigurations(Boolean startup, Boolean botConfigurationChanged)
Checks that configurations are synchronized with the database.
-
getRequestTimer
final RequestTimer getRequestTimer()
Request timer for connectors.
-
setRequestTimer
final Unit setRequestTimer(RequestTimer requestTimer)
Request timer for connectors.
-
getHealthcheckHandler
final Function1<RoutingContext, Unit> getHealthcheckHandler()
-
setHealthcheckHandler
final Unit setHealthcheckHandler(Function1<RoutingContext, Unit> healthcheckHandler)
-
-
-
-