public TimeoutMiddleware(IConfiguration configuration, ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <TimeoutMiddleware>(); string connectionString = configuration[KeyAzureTableStorageConnectionString]; if (string.IsNullOrEmpty(connectionString)) { _logger.LogError($"WARNING!!! No connection string found - using {nameof(InMemoryRoutingDataStore)}"); _routingDataStore = new InMemoryRoutingDataStore(); } else { _logger.LogDebug($"Found a connection string - using {nameof(AzureTableRoutingDataStore)}"); _routingDataStore = new AzureTableRoutingDataStore(connectionString, new Underscore.Bot.MessageRouting.Logging.ConsoleLogger(loggerFactory.CreateLogger <AzureTableRoutingDataStore>())); } _timeout = TimeSpan.FromSeconds(Double.Parse(configuration[KeyConversationTimeout] ?? "3600")); _logger.LogInformation($"Bot Conversation Timeout set to {_timeout.ToString()}"); _messageRouter = new MessageRouter( _routingDataStore, new MicrosoftAppCredentials(configuration["MicrosoftAppId"], configuration["MicrosoftAppPassword"]), logger: new Underscore.Bot.MessageRouting.Logging.ConsoleLogger(loggerFactory.CreateLogger <MessageRouter>())); _endOfConversationActivity = Activity.CreateMessageActivity(); _endOfConversationActivity.Type = ActivityTypes.EndOfConversation; }
/// <summary> /// Constructor. /// </summary> /// <param name="routingDataStore">The routing data store implementation.</param> /// <param name="globalTimeProvider">The global time provider for providing the current /// time for various events such as when a connection is requested.</param> /// <param name="logger">Logger to use.</param> public RoutingDataManager( IRoutingDataStore routingDataStore, GlobalTimeProvider globalTimeProvider = null, ILogger logger = null) { RoutingDataStore = routingDataStore ?? throw new ArgumentNullException("Routing data store missing"); GlobalTimeProvider = globalTimeProvider ?? new GlobalTimeProvider(); _logger = logger ?? new DebugLogger(); }
/// <summary> /// Constructor. /// </summary> /// <param name="routingDataStore">The routing data store implementation.</param> /// <param name="microsoftAppCredentials">The bot application credentials. /// May be required, depending on the setup of your app, for sending messages.</param> /// <param name="globalTimeProvider">The global time provider for providing the current /// <param name="ILogger">Logger to use. Defaults to DebugLogger.</param> /// time for various events such as when a connection is requested.</param> public MessageRouter( IRoutingDataStore routingDataStore, MicrosoftAppCredentials microsoftAppCredentials, GlobalTimeProvider globalTimeProvider = null, ILogger logger = null) { Logger = logger ?? new DebugLogger(); RoutingDataManager = new RoutingDataManager(routingDataStore, globalTimeProvider, Logger); _microsoftAppCredentials = microsoftAppCredentials; }
public HandoffMiddlewareBase(IConfiguration configuration, ILoggerFactory loggerFactory) { Configuration = configuration; _logger = loggerFactory.CreateLogger <HandoffMiddlewareBase>(); string connectionString = Configuration[KeyAzureTableStorageConnectionString]; IRoutingDataStore routingDataStore = null; if (string.IsNullOrEmpty(connectionString)) { _logger.LogDebug($"WARNING!!! No connection string found - using {nameof(InMemoryRoutingDataStore)}"); routingDataStore = new InMemoryRoutingDataStore(); } else { _logger.LogDebug($"Found a connection string - using {nameof(AzureTableRoutingDataStore)}"); routingDataStore = new AzureTableRoutingDataStore(connectionString, new Underscore.Bot.MessageRouting.Logging.ConsoleLogger(loggerFactory.CreateLogger <AzureTableRoutingDataStore>())); } MessageRouter = new MessageRouter( routingDataStore, new MicrosoftAppCredentials(Configuration["MicrosoftAppId"], Configuration["MicrosoftAppPassword"]), logger: new Underscore.Bot.MessageRouting.Logging.ConsoleLogger(loggerFactory.CreateLogger <MessageRouter>()) ); //MessageRouter.Logger = new Logging.AggregationChannelLogger(MessageRouter); MessageRouterResultHandler = new MessageRouterResultHandler(MessageRouter); ConnectionRequestHandler connectionRequestHandler = new ConnectionRequestHandler(GetChannelList(KeyNoDirectConversationsWithChannels)); CommandHandler = new CommandHandler( MessageRouter, MessageRouterResultHandler, connectionRequestHandler, GetChannelList(KeyPermittedAggregationChannels), new Underscore.Bot.MessageRouting.Logging.ConsoleLogger(loggerFactory.CreateLogger <CommandHandler>())); MessageLogs = new MessageLogs(connectionString, new Underscore.Bot.MessageRouting.Logging.ConsoleLogger(loggerFactory.CreateLogger <MessageLogs>())); }
public HandoffMiddleware(IConfiguration configuration, ConversationState conversationState, UserState userState) { Configuration = configuration; _conversationState = conversationState; _userState = userState; string connectionString = Configuration[KeyAzureTableStorageConnectionString]; IRoutingDataStore routingDataStore = null; if (string.IsNullOrEmpty(connectionString)) { System.Diagnostics.Debug.WriteLine($"WARNING!!! No connection string found - using {nameof(InMemoryRoutingDataStore)}"); routingDataStore = new InMemoryRoutingDataStore(); } else { System.Diagnostics.Debug.WriteLine($"Found a connection string - using {nameof(AzureTableRoutingDataStore)}"); routingDataStore = new AzureTableRoutingDataStore(connectionString); } MessageRouter = new MessageRouter( routingDataStore, new MicrosoftAppCredentials(Configuration["MicrosoftAppId"], Configuration["MicrosoftAppPassword"])); //MessageRouter.Logger = new Logging.AggregationChannelLogger(MessageRouter); MessageRouterResultHandler = new MessageRouterResultHandler(MessageRouter); ConnectionRequestHandler connectionRequestHandler = new ConnectionRequestHandler(GetChannelList(KeyNoDirectConversationsWithChannels)); CommandHandler = new CommandHandler( MessageRouter, MessageRouterResultHandler, connectionRequestHandler, GetChannelList(KeyPermittedAggregationChannels)); MessageLogs = new MessageLogs(connectionString); }
public BotRoutingDataManager(IRoutingDataStore routingDataStore, ILogger <BotRoutingDataManager> logger) { _routingDataStore = routingDataStore; _logger = logger; }