forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RavenDB-21956 RavenDB-21956 wip RavenDB-21956 tests wip RavenDB-21956 wip RavenDB-21956 AzureStorageQueue -> AzureQueueStorage RavenDB-21956 Add passwordless option
- Loading branch information
1 parent
0593ffb
commit e7b6167
Showing
15 changed files
with
677 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...s/Queue/Handlers/Processors/QueueEtlHandlerProcessorForTestAzureQueueStorageConnection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using Azure.Storage.Queues; | ||
using JetBrains.Annotations; | ||
using Newtonsoft.Json; | ||
using Raven.Client.Documents.Operations.ETL.Queue; | ||
using Raven.Server.Documents.Handlers.Processors; | ||
using Raven.Server.Web.System; | ||
using Sparrow.Json; | ||
using Sparrow.Json.Parsing; | ||
|
||
namespace Raven.Server.Documents.ETL.Providers.Queue.Handlers.Processors; | ||
|
||
internal sealed class | ||
QueueEtlHandlerProcessorForTestAzureQueueStorageConnection<TRequestHandler, TOperationContext> : | ||
AbstractDatabaseHandlerProcessor<TRequestHandler, TOperationContext> | ||
where TOperationContext : JsonOperationContext | ||
where TRequestHandler : AbstractDatabaseRequestHandler<TOperationContext> | ||
{ | ||
public QueueEtlHandlerProcessorForTestAzureQueueStorageConnection([NotNull] TRequestHandler requestHandler) : | ||
base(requestHandler) | ||
{ | ||
} | ||
|
||
public override async ValueTask ExecuteAsync() | ||
{ | ||
try | ||
{ | ||
string authenticationJson = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync(); | ||
Authentication authentication = JsonConvert.DeserializeObject<Authentication>(authenticationJson); | ||
|
||
var connectionSettings = new AzureQueueStorageConnectionSettings() { Authentication = authentication }; | ||
|
||
QueueServiceClient client = | ||
QueueBrokerConnectionHelper.CreateAzureQueueStorageServiceClient(connectionSettings); | ||
|
||
await client.GetStatisticsAsync(); | ||
|
||
DynamicJsonValue result = new() { [nameof(NodeConnectionTestResult.Success)] = true, }; | ||
using (ServerStore.ContextPool.AllocateOperationContext(out JsonOperationContext context)) | ||
await using (AsyncBlittableJsonTextWriter writer = new(context, RequestHandler.ResponseBodyStream())) | ||
{ | ||
context.Write(writer, result); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
using (ServerStore.ContextPool.AllocateOperationContext(out JsonOperationContext context)) | ||
{ | ||
await using (var writer = | ||
new AsyncBlittableJsonTextWriter(context, RequestHandler.ResponseBodyStream())) | ||
{ | ||
context.Write(writer, | ||
new DynamicJsonValue | ||
{ | ||
[nameof(NodeConnectionTestResult.Success)] = false, | ||
[nameof(NodeConnectionTestResult.Error)] = ex.ToString() | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.