private PersistedQueue <T> CreatePersistedQueue <T>(int inMemoryCapacity = 1024) { IPersistence <T> persistence = new InMemoryPersistence <T>(); PersistedQueueConfiguration config = new PersistedQueueConfiguration { MaxItemsInMemory = inMemoryCapacity }; return(new PersistedQueue <T>(persistence, config)); }
public MessageQueueMapperForSyntaxExtension SendMessageToPersistedQueue(Action <PersistedQueueConfiguration> options) { var parameter = new PersistedQueueConfiguration(); options.Invoke(parameter); SetDefaultValue(parameter); return(new MessageQueueMapperForSyntaxExtension(_services, _configuration, parameter)); }
public MessageQueueMapperForSyntaxExtension SendMessageToPersistedQueue(string section, Func <PolicyBuilder, RetryPolicy> customRetryPolicy = null) { var parameter = new PersistedQueueConfiguration(); _configuration.GetSection(section).Bind(parameter); if (null != customRetryPolicy) { parameter.RetryPolicy = customRetryPolicy; } SetDefaultValue(parameter); return(new MessageQueueMapperForSyntaxExtension(_services, _configuration, parameter)); }
private async Task InMemoryInt() { IPersistence <int> persistence = new InMemoryPersistence <int>(); PersistedQueueConfiguration config = new PersistedQueueConfiguration { MaxItemsInMemory = itemsToKeepInMemory }; PersistedQueue <int> queue = new PersistedQueue <int>(persistence, config); for (int i = 0; i < totalItems; i++) { queue.Enqueue(i); } for (int i = 0; i < totalItems; i++) { await queue.DequeueAsync(); } }
public void IterationSetup() { if (useLargeData) { largePersistence = new NosqlPersistence <LargeData>(PersistenceFilePath); PersistedQueueConfiguration config = new PersistedQueueConfiguration { MaxItemsInMemory = itemsToKeepInMemory }; largeQueue = new PersistedQueue <LargeData>(largePersistence, config); } else { smallPersistence = new NosqlPersistence <int>(PersistenceFilePath); PersistedQueueConfiguration config = new PersistedQueueConfiguration { MaxItemsInMemory = itemsToKeepInMemory }; smallQueue = new PersistedQueue <int>(smallPersistence, config); } }