private async Task <AzureQueueDataManager> GetTableManager(string qName) { AzureQueueDataManager manager = new AzureQueueDataManager(qName, DeploymentId, TestDefaultConfiguration.DataConnectionString); await manager.InitQueueAsync(); return(manager); }
private async Task <AzureQueueDataManager> GetTableManager(string qName) { AzureQueueDataManager manager = new AzureQueueDataManager(qName, DeploymentId, StorageTestConstants.DataConnectionString); await manager.InitQueueAsync(); return(manager); }
private async Task <AzureQueueDataManager> GetTableManager(string qName, TimeSpan?visibilityTimeout = null) { AzureQueueDataManager manager = new AzureQueueDataManager(this.loggerFactory, qName, DeploymentId, TestDefaultConfiguration.DataConnectionString, visibilityTimeout); await manager.InitQueueAsync(); return(manager); }
public Task Initialize(TimeSpan timeout) { if (queue != null) // check in case we already shut it down. { return(queue.InitQueueAsync()); } return(TaskDone.Done); }
private async Task <AzureQueueDataManager> GetTableManager(string qName, TimeSpan?visibilityTimeout = null) { AzureQueueDataManager manager = new AzureQueueDataManager(this.loggerFactory, $"{qName}-{DeploymentId}", new AzureQueueOptions { MessageVisibilityTimeout = visibilityTimeout }.ConfigureTestDefaults()); await manager.InitQueueAsync(); return(manager); }
public async Task QueueMessageBatchAsync <T>(Guid streamGuid, String streamNamespace, IEnumerable <T> events, StreamSequenceToken token, Dictionary <string, object> requestContext) { if (events == null) { throw new ArgumentNullException("events", "Trying to QueueMessageBatchAsync null data."); } //int count = events.Count(); //if (count != 1) //{ // throw new OrleansException("Trying to QueueMessageBatchAsync a batch of more than one event. " + // "SimpleAzureQueueAdapter does not support batching. Instead, you can batch in your application code."); //} object data = events.First(); bool isBytes = data is byte[]; bool isString = data is string; if (data != null && !isBytes && !isString) { throw new OrleansException( string.Format( "Trying to QueueMessageBatchAsync a type {0} which is not a byte[] and not string. " + "SimpleAzureQueueAdapter only supports byte[] or string.", data.GetType())); } if (Queue == null) { var tmpQueue = new AzureQueueDataManager(this.loggerFactory, QueueName, DataConnectionString); await tmpQueue.InitQueueAsync(); if (Queue == null) { Queue = tmpQueue; } } CloudQueueMessage cloudMsg = null; if (isBytes) { //new CloudQueueMessage(byte[]) not supported in netstandard cloudMsg = new CloudQueueMessage(null as string); cloudMsg.SetMessageContent2(data as byte[]); } else if (isString) { cloudMsg = new CloudQueueMessage(data as string); } else if (data == null) { // It's OK to pass null data. why should I care? cloudMsg = new CloudQueueMessage(null as string); } await Queue.AddQueueMessage(cloudMsg); }
public async Task QueueMessageBatchAsync <T>(Guid streamGuid, String streamNamespace, IEnumerable <T> events) { var queueId = streamQueueMapper.GetQueueForStream(streamGuid); AzureQueueDataManager queue; if (!Queues.TryGetValue(queueId, out queue)) { var tmpQueue = new AzureQueueDataManager(queueId.ToString(), DeploymentId, DataConnectionString); await tmpQueue.InitQueueAsync(); queue = Queues.GetOrAdd(queueId, tmpQueue); } var cloudMsg = AzureQueueBatchContainer.ToCloudQueueMessage(streamGuid, streamNamespace, events); await queue.AddQueueMessage(cloudMsg); }
public async Task QueueMessageBatchAsync <T>(StreamId streamId, IEnumerable <T> events, StreamSequenceToken token, Dictionary <string, object> requestContext) { if (events == null) { throw new ArgumentNullException("events", "Trying to QueueMessageBatchAsync null data."); } object data = events.First(); bool isBytes = data is byte[]; bool isString = data is string; if (data != null && !isBytes && !isString) { throw new OrleansException( string.Format( "Trying to QueueMessageBatchAsync a type {0} which is not a byte[] and not string. " + "SimpleAzureQueueAdapter only supports byte[] or string.", data.GetType())); } if (Queue == null) { var tmpQueue = new AzureQueueDataManager(this.loggerFactory, options.QueueName, new AzureQueueOptions { ConnectionString = options.ConnectionString, ServiceUri = options.ServiceUri, TokenCredential = options.TokenCredential }); await tmpQueue.InitQueueAsync(); if (Queue == null) { Queue = tmpQueue; } } string cloudMsg = null; if (isBytes) { cloudMsg = Convert.ToBase64String(data as byte[]); } else if (isString) { cloudMsg = data as string; } await Queue.AddQueueMessage(cloudMsg); }
public async Task QueueMessageBatchAsync <T>(Guid streamGuid, String streamNamespace, IEnumerable <T> events, StreamSequenceToken token, Dictionary <string, object> requestContext) { if (token != null) { throw new ArgumentException("AzureQueue stream provider currebtly does not support non-null StreamSequenceToken.", "token"); } var queueId = streamQueueMapper.GetQueueForStream(streamGuid, streamNamespace); AzureQueueDataManager queue; if (!Queues.TryGetValue(queueId, out queue)) { var tmpQueue = new AzureQueueDataManager(queueId.ToString(), DeploymentId, DataConnectionString); await tmpQueue.InitQueueAsync(); queue = Queues.GetOrAdd(queueId, tmpQueue); } var cloudMsg = AzureQueueBatchContainer.ToCloudQueueMessage(streamGuid, streamNamespace, events, requestContext); await queue.AddQueueMessage(cloudMsg); }
public async Task QueueMessageBatchAsync <T>(StreamId streamId, IEnumerable <T> events, StreamSequenceToken token, Dictionary <string, object> requestContext) { if (token != null) { throw new ArgumentException("AzureQueue stream provider currently does not support non-null StreamSequenceToken.", nameof(token)); } var queueId = streamQueueMapper.GetQueueForStream(streamId); AzureQueueDataManager queue; if (!Queues.TryGetValue(queueId, out queue)) { var tmpQueue = new AzureQueueDataManager(this.loggerFactory, this.streamQueueMapper.PartitionToAzureQueue(queueId), queueOptions); await tmpQueue.InitQueueAsync(); queue = Queues.GetOrAdd(queueId, tmpQueue); } var cloudMsg = this.dataAdapter.ToQueueMessage(streamId, events, null, requestContext); await queue.AddQueueMessage(cloudMsg); }
public async Task QueueMessageBatchAsync <T>(Guid streamGuid, string streamNamespace, IEnumerable <T> events, StreamSequenceToken token, Dictionary <string, object> requestContext) { if (token != null) { throw new ArgumentException("AzureQueue stream provider currently does not support non-null StreamSequenceToken.", nameof(token)); } var queueId = streamQueueMapper.GetQueueForStream(streamGuid, streamNamespace); AzureQueueDataManager queue; if (!Queues.TryGetValue(queueId, out queue)) { var tmpQueue = new AzureQueueDataManager(this.loggerFactory, queueId.ToString(), ServiceId, DataConnectionString, MessageVisibilityTimeout); await tmpQueue.InitQueueAsync(); queue = Queues.GetOrAdd(queueId, tmpQueue); } var cloudMsg = this.dataAdapter.ToCloudQueueMessage(streamGuid, streamNamespace, events, requestContext); await queue.AddQueueMessage(cloudMsg); }
public async Task AQ_Standalone_3_CreateDelete() { queueName = "Test-3-".ToLower() + Guid.NewGuid(); AzureQueueDataManager manager = await GetTableManager(queueName); await manager.InitQueueAsync(); await manager.DeleteQueue(); AzureQueueDataManager manager2 = await GetTableManager(queueName); await manager2.InitQueueAsync(); await manager2.DeleteQueue(); AzureQueueDataManager manager3 = await GetTableManager(queueName); await manager3.DeleteQueue(); await manager3.DeleteQueue(); await manager3.DeleteQueue(); }
public Task Initialize(TimeSpan timeout) { return(queue.InitQueueAsync()); }