public static AzurePartitionInbox CreateInbox(this IAzureStorageConfig cfg, string name, Func <uint, TimeSpan> decay = null, TimeSpan visibilityTimeout = default(TimeSpan)) { var intake = BuildIntake(cfg, name, visibilityTimeout); var waiter = decay ?? DecayEvil.BuildExponentialDecay(2000); return(new AzurePartitionInbox(new[] { intake }, waiter)); }
public static FilePartitionInbox CreateInbox(this FileStorageConfig cfg, string name, Func <uint, TimeSpan> decay = null) { var reader = new StatelessFileQueueReader(Path.Combine(cfg.FullPath, name), name); var waiter = decay ?? DecayEvil.BuildExponentialDecay(250); var inbox = new FilePartitionInbox(new[] { reader, }, waiter); inbox.Init(); return(inbox); }
public static Container BuildEnvironment() { //JsConfig.DateHandler = JsonDateHandler.ISO8601; ConfigureObserver(); var integrationPath = AzureSettingsProvider.GetStringOrThrow(Conventions.StorageConfigName); //var email = AzureSettingsProvider.GetStringOrThrow(Conventions.SmtpConfigName); //var core = new SmtpHandlerCore(email); var setup = new Setup { //Smtp = core, //FreeApiKey = freeApiKey, //WebClientUrl = clientUri, //HttpEndpoint = endPoint, //EncryptorTool = new EncryptorTool(systemKey) }; if (integrationPath.StartsWith("file:")) { var path = integrationPath.Remove(0, 5); SystemObserver.Notify("Using store : {0}", path); var config = FileStorage.CreateConfig(path); setup.Streaming = config.CreateStreaming(); setup.DocumentStoreFactory = config.CreateDocumentStore; setup.QueueReaderFactory = s => config.CreateInbox(s, DecayEvil.BuildExponentialDecay(500)); setup.QueueWriterFactory = config.CreateQueueWriter; setup.AppendOnlyStoreFactory = config.CreateAppendOnlyStore; setup.ConfigureQueues(1, 1); return(setup.Build()); } if (integrationPath.StartsWith("Default") || integrationPath.Equals("UseDevelopmentStorage=true", StringComparison.InvariantCultureIgnoreCase)) { var config = AzureStorage.CreateConfig(integrationPath); setup.Streaming = config.CreateStreaming(); setup.DocumentStoreFactory = config.CreateDocumentStore; setup.QueueReaderFactory = s => config.CreateQueueReader(s); setup.QueueWriterFactory = config.CreateQueueWriter; setup.AppendOnlyStoreFactory = config.CreateAppendOnlyStore; setup.ConfigureQueues(4, 4); return(setup.Build()); } throw new InvalidOperationException("Unsupported environment"); }
/// <summary> /// Sets the custom decay policy used to throttle Azure queue checks, when there are no messages for some time. /// This overload eventually slows down requests till the max of <paramref name="maxInterval"/>. /// </summary> /// <param name="maxInterval">The maximum interval to keep between checks, when there are no messages in the queue.</param> public void DecayPolicy(TimeSpan maxInterval) { _decayPolicy = DecayEvil.BuildExponentialDecay(maxInterval); }