From 7764855daf87071f30f13c4a78ee133edad9d59c Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Thu, 10 Jul 2025 07:50:38 -0500 Subject: [PATCH 01/28] WIP: processing inline with Rabbit MQ --- .../process_inline_compliance.cs | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/process_inline_compliance.cs diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/process_inline_compliance.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/process_inline_compliance.cs new file mode 100644 index 000000000..78b48c740 --- /dev/null +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/process_inline_compliance.cs @@ -0,0 +1,82 @@ +using IntegrationTests; +using JasperFx.Core; +using Shouldly; +using Wolverine.ComplianceTests.Compliance; +using Wolverine.Configuration; +using Wolverine.Postgresql; +using Wolverine.RabbitMQ.Internal; +using Wolverine.Tracking; +using Xunit; + +namespace Wolverine.RabbitMQ.Tests; + + +public class ProcessInlineFixture : TransportComplianceFixture, IAsyncLifetime +{ + public ProcessInlineFixture() : base($"rabbitmq://queue/inline1".ToUri()) + { + } + + public async Task InitializeAsync() + { + OutboundAddress = $"rabbitmq://queue/inline1".ToUri(); + + await SenderIs(opts => + { + var listener = $"listener{RabbitTesting.Number}"; + + opts.Durability.Mode = DurabilityMode.Solo; + + opts.UseRabbitMq() + .AutoProvision() + .AutoPurgeOnStartup() + .DisableDeadLetterQueueing() + .DeclareQueue("quorum1").ConfigureListeners(l => l.ProcessInline()); + + opts.PersistMessagesWithPostgresql(Servers.PostgresConnectionString, "inline_sender"); + + opts.ListenToRabbitQueue("inline2").TelemetryEnabled(false); + }); + + await ReceiverIs(opts => + { + opts.Durability.Mode = DurabilityMode.Solo; + + opts.UseRabbitMq() + .DisableDeadLetterQueueing() + .ConfigureListeners(l => l.ProcessInline()); + + opts.PersistMessagesWithPostgresql(Servers.PostgresConnectionString, "inline_receiver"); + + opts.ListenToRabbitQueue("inline1").TelemetryEnabled(false); + }); + } + + public async Task DisposeAsync() + { + await DisposeAsync(); + } +} + +public class process_inline_compliance : TransportCompliance +{ + [Fact] + public void all_queues_are_declared_as_quorum() + { + var queues = theSender + .GetRuntime() + .Options + .Transports + .AllEndpoints() + .OfType() + .Where(x => x.Role == EndpointRole.Application) + .ToArray(); + + queues.Any().ShouldBeTrue(); + foreach (var mqQueue in queues) + { + mqQueue.QueueType.ShouldBe(QueueType.quorum); + } + + } +} From 899c8b0c8ddba5972cf907a2405753a3d440d025 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Thu, 10 Jul 2025 09:15:44 -0500 Subject: [PATCH 02/28] Making sure that messages get Ack'd in the combination of Inline endpoints with native DLQ disabled --- .../process_inline_compliance.cs | 20 +------------------ src/Wolverine/Runtime/MessageContext.cs | 5 ++++- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/process_inline_compliance.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/process_inline_compliance.cs index 78b48c740..3232daa53 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/process_inline_compliance.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/process_inline_compliance.cs @@ -60,23 +60,5 @@ public async Task DisposeAsync() public class process_inline_compliance : TransportCompliance { - [Fact] - public void all_queues_are_declared_as_quorum() - { - var queues = theSender - .GetRuntime() - .Options - .Transports - .AllEndpoints() - .OfType() - .Where(x => x.Role == EndpointRole.Application) - .ToArray(); - - queues.Any().ShouldBeTrue(); - foreach (var mqQueue in queues) - { - mqQueue.QueueType.ShouldBe(QueueType.quorum); - } - - } + } diff --git a/src/Wolverine/Runtime/MessageContext.cs b/src/Wolverine/Runtime/MessageContext.cs index 82df33cfe..3ac2f6013 100644 --- a/src/Wolverine/Runtime/MessageContext.cs +++ b/src/Wolverine/Runtime/MessageContext.cs @@ -153,7 +153,7 @@ public async Task MoveToDeadLetterQueueAsync(Exception exception) throw new InvalidOperationException("No Envelope is active for this context"); } - if (_channel is ISupportDeadLetterQueue c && c.NativeDeadLetterQueueEnabled) + if (_channel is ISupportDeadLetterQueue { NativeDeadLetterQueueEnabled: true } c) { if (Envelope.Batch != null) { @@ -182,6 +182,9 @@ public async Task MoveToDeadLetterQueueAsync(Exception exception) // If persistable, persist await Storage.Inbox.MoveToDeadLetterStorageAsync(Envelope, exception); } + + // If this is Inline + await _channel.CompleteAsync(Envelope); } public Task RetryExecutionNowAsync() From cb252c15e00afffc5716e5f1b013914c7704ac31 Mon Sep 17 00:00:00 2001 From: Anne Erdtsieck Date: Wed, 9 Jul 2025 18:05:49 +0200 Subject: [PATCH 03/28] Improve xml docs on UseWolverineManagedEventSubscriptionDistribution --- src/Persistence/Wolverine.Marten/MartenIntegration.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Persistence/Wolverine.Marten/MartenIntegration.cs b/src/Persistence/Wolverine.Marten/MartenIntegration.cs index ee9a7d5f3..10e764086 100644 --- a/src/Persistence/Wolverine.Marten/MartenIntegration.cs +++ b/src/Persistence/Wolverine.Marten/MartenIntegration.cs @@ -32,9 +32,9 @@ public class MartenIntegration : IWolverineExtension, IEventForwarding public bool UseFastEventForwarding { get; set; } /// - /// Use Wolverine to evenly distribute event projection and subscription work of Marten - /// asynchronous projections. This should be used exclusively with Marten's AddAsyncDaemon() option - /// and takes the place of Marten's built in, naive load distribution + /// Use this when using Wolverine to evenly distribute event projection and subscription + /// work of Marten asynchronous projections. This replaces Marten's AddAsyncMarten(HotCold) + /// option and should not be used in combination with Marten's own load distribution. /// public bool UseWolverineManagedEventSubscriptionDistribution { get; set; } From 25a7aed23a31cf39909dd4540484d686c3f0f2c4 Mon Sep 17 00:00:00 2001 From: Donnie Hale <167324638+donniehale-tl@users.noreply.github.com> Date: Thu, 3 Jul 2025 15:48:37 -0400 Subject: [PATCH 04/28] Change Oakton references to JasperFx --- docs/guide/diagnostics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide/diagnostics.md b/docs/guide/diagnostics.md index 933a673a9..f823a423c 100644 --- a/docs/guide/diagnostics.md +++ b/docs/guide/diagnostics.md @@ -4,8 +4,8 @@ Wolverine can be configuration intensive, allows for quite a bit of customizatio quite a bit of external infrastructure. All of those things can be problematic, so Wolverine tries to provide diagnostic tools to unwind what's going on inside the application and the application's configuration. -Many of the diagnostics explained in this page are part of the [Oakton command line integration](https://jasperfx.github.io/oakton). As a reminder, -to utilize this command line integration, you need to apply Oakton as your command line parser as shown in the last line of the quickstart +Many of the diagnostics explained in this page are part of the [JasperFx command line integration](https://jasperfx.github.io/oakton) <== NOT SURE OF THE RIGHT URL. As a reminder, +to utilize this command line integration, you need to apply JasperFx as your command line parser as shown in the last line of the quickstart sample `Program.cs` file: From bd3204862580fa4071bb990bd5548ec9c643a3cf Mon Sep 17 00:00:00 2001 From: Pavel Voronin Date: Wed, 2 Jul 2025 18:09:11 +0200 Subject: [PATCH 05/28] Update getting-started.md to fix the broken link. Fix the link of the reference `See also: Wolverine as Command Bus` in the "Getting Started" of the documentation. --- docs/introduction/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/introduction/getting-started.md b/docs/introduction/getting-started.md index 85c8944d4..80197882d 100644 --- a/docs/introduction/getting-started.md +++ b/docs/introduction/getting-started.md @@ -99,7 +99,7 @@ Alright, let's talk about what we wrote up above: 2. We registered the `UserRepository` and `IssueRepository` services 3. We created a couple [Minimal API](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis?view=aspnetcore-6.0) endpoints -See also: [Wolverine as Command Bus](/guide/in-memory-bus) +See also: [Wolverine as Command Bus](/guide/messaging/transports/local.html) The two Web API functions directly delegate to Wolverine's `IMessageBus.InvokeAsync()` method. In that method, Wolverine will direct the command to the correct handler and invoke that handler From e5232cfb1470ffe49978df03004578039abcde4b Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 08:40:56 -0500 Subject: [PATCH 06/28] Asserts that you cannot directly send ISendMyself objects as messages. Closes GH-1565 --- .../publishing_ISendMyself_messages.cs | 28 +++++++++++++++++++ src/Wolverine/Runtime/MessageBus.cs | 21 +++++++++++++- src/Wolverine/Runtime/MessageContext.cs | 4 +-- 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 src/Testing/CoreTests/Acceptance/publishing_ISendMyself_messages.cs diff --git a/src/Testing/CoreTests/Acceptance/publishing_ISendMyself_messages.cs b/src/Testing/CoreTests/Acceptance/publishing_ISendMyself_messages.cs new file mode 100644 index 000000000..8ddb901c2 --- /dev/null +++ b/src/Testing/CoreTests/Acceptance/publishing_ISendMyself_messages.cs @@ -0,0 +1,28 @@ +using Wolverine.Runtime; +using Wolverine.Tracking; +using Xunit; + +namespace CoreTests.Acceptance; + +public class publishing_ISendMyself_messages : IntegrationContext +{ + public publishing_ISendMyself_messages(DefaultApp @default) : base(@default) + { + } + + [Fact] + public async Task assert_can_not_send_with_isendmyself() + { + var selfSender = new SelfSender(Guid.NewGuid()); + var tracked = await Host.SendMessageAndWaitAsync(selfSender); + tracked.Executed.SingleMessage().Id.ShouldBe(selfSender.Id); + } + + [Fact] + public async Task assert_can_not_publish_with_isendmyself() + { + var selfSender = new SelfSender(Guid.NewGuid()); + var tracked = await Host.ExecuteAndWaitValueTaskAsync(c => c.PublishAsync(selfSender)); + tracked.Executed.SingleMessage().Id.ShouldBe(selfSender.Id); + } +} \ No newline at end of file diff --git a/src/Wolverine/Runtime/MessageBus.cs b/src/Wolverine/Runtime/MessageBus.cs index cbd27696a..6f575cf4f 100644 --- a/src/Wolverine/Runtime/MessageBus.cs +++ b/src/Wolverine/Runtime/MessageBus.cs @@ -7,7 +7,7 @@ namespace Wolverine.Runtime; -public class MessageBus : IMessageBus +public class MessageBus : IMessageBus, IMessageContext { public static MessageBus Build(IWolverineRuntime runtime, string correlationId) => new MessageBus(runtime, correlationId); @@ -42,6 +42,11 @@ private void assertNotMediatorOnly() } public string? CorrelationId { get; set; } + public Envelope? Envelope { get; protected set; } + public virtual ValueTask RespondToSenderAsync(object response) + { + throw new NotSupportedException("Not supported from MessageBus, only within message handlers executing against MessageContext"); + } public IWolverineRuntime Runtime { get; } public IMessageStore Storage { get; protected set; } @@ -146,6 +151,13 @@ public ValueTask SendAsync(T message, DeliveryOptions? options = null) { throw new ArgumentNullException(nameof(message)); } + + // Check for both so you don't get an infinite loop + // from TimeoutMessage + if (options == null && message is ISendMyself m) + { + return m.ApplyAsync(this); + } Runtime.AssertHasStarted(); assertNotMediatorOnly(); @@ -164,6 +176,13 @@ public ValueTask PublishAsync(T message, DeliveryOptions? options = null) throw new ArgumentNullException(nameof(message)); } + // Check for both so you don't get an infinite loop + // from TimeoutMessage + if (options == null && message is ISendMyself m) + { + return m.ApplyAsync(this); + } + Runtime.AssertHasStarted(); assertNotMediatorOnly(); diff --git a/src/Wolverine/Runtime/MessageContext.cs b/src/Wolverine/Runtime/MessageContext.cs index 3ac2f6013..bcb3cbc43 100644 --- a/src/Wolverine/Runtime/MessageContext.cs +++ b/src/Wolverine/Runtime/MessageContext.cs @@ -296,7 +296,7 @@ public ValueTask RollbackAsync() /// /// /// - public ValueTask RespondToSenderAsync(object response) + public override ValueTask RespondToSenderAsync(object response) { if (Envelope == null) { @@ -312,8 +312,6 @@ public ValueTask RespondToSenderAsync(object response) return EndpointFor(Envelope.ReplyUri).SendAsync(response); } - public Envelope? Envelope { get; protected set; } - internal async Task CopyToAsync(IEnvelopeTransaction other) { await other.PersistOutgoingAsync(_outstanding.ToArray()); From 6a92fd12e91515d121e0830d547575a6acfa953e Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 09:37:47 -0500 Subject: [PATCH 07/28] Ability to do request/reply correctly when using named brokers to publish, but not on the receiving end. Closes GH-1563 --- .../end_to_end_with_named_broker.cs | 48 +++++++++++++++++++ src/Wolverine/Envelope.Internals.cs | 11 ++++- src/Wolverine/Runtime/MessageContext.cs | 3 ++ src/Wolverine/Wolverine.csproj | 2 +- 4 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/end_to_end_with_named_broker.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/end_to_end_with_named_broker.cs index 6f97ad16d..902cdc3ed 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/end_to_end_with_named_broker.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/end_to_end_with_named_broker.cs @@ -5,6 +5,7 @@ using Wolverine.ComplianceTests; using Wolverine.RabbitMQ.Internal; using Wolverine.Runtime; +using Wolverine.Tracking; using Xunit; using Xunit.Abstractions; @@ -66,4 +67,51 @@ public async Task send_message_to_and_receive_through_rabbitmq_with_inline_recei } + [Fact] + public async Task correct_scheme_on_reply_uri() + { + var queueName = RabbitTesting.NextQueueName(); + using var publisher = WolverineHost.For(opts => + { + opts.Discovery.DisableConventionalDiscovery(); + + opts.AddNamedRabbitMqBroker(theName, factory => {}).AutoProvision().AutoPurgeOnStartup(); + + opts.PublishAllMessages() + .ToRabbitQueueOnNamedBroker(theName, queueName) + .SendInline(); + + opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + }); + + + using var receiver = WolverineHost.For(opts => + { + opts.UseRabbitMq().AutoProvision(); + + opts.ListenToRabbitQueue(queueName).Named(queueName); + + opts.Services.AddSingleton(); + + opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + }); + + await receiver.ResetResourceState(); + + var request = new RequestId(Guid.NewGuid()); + var (tracked, response) = + await publisher.TrackActivity().AlsoTrack(receiver).InvokeAndWaitAsync(request); + + response.Id.ShouldBe(request.Id); + tracked.Received.SingleEnvelope().Destination.Scheme.ShouldBe("other"); + } + +} + +public record RequestId(Guid Id); +public record ResponseId(Guid Id); + +public static class RequestIdHandler +{ + public static ResponseId Handle(RequestId message) => new ResponseId(message.Id); } \ No newline at end of file diff --git a/src/Wolverine/Envelope.Internals.cs b/src/Wolverine/Envelope.Internals.cs index 585d916cb..e1ff2c5d3 100644 --- a/src/Wolverine/Envelope.Internals.cs +++ b/src/Wolverine/Envelope.Internals.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using System.Runtime.InteropServices; +using JasperFx.Core; using Wolverine.Persistence.Durability; using Wolverine.Runtime; using Wolverine.Runtime.Serialization; @@ -35,7 +36,7 @@ internal Envelope(object message, ISendingAgent agent) Serializer = message is ISerializable ? IntrinsicSerializer.Instance : agent.Endpoint.DefaultSerializer; ContentType = Serializer!.ContentType; Destination = agent.Destination; - ReplyUri = agent.ReplyUri; + ReplyUri = agent.ReplyUri?.MaybeCorrectScheme(agent.Destination.Scheme); } internal Envelope(object message, IMessageSerializer writer) @@ -334,4 +335,12 @@ internal bool IsFromLocalDurableQueue() { return Sender is DurableLocalQueue; } + + internal void MaybeCorrectReplyUri() + { + if (ReplyUri != null && Destination != null) + { + ReplyUri = ReplyUri.MaybeCorrectScheme(Destination.Scheme); + } + } } \ No newline at end of file diff --git a/src/Wolverine/Runtime/MessageContext.cs b/src/Wolverine/Runtime/MessageContext.cs index bcb3cbc43..03ee366ef 100644 --- a/src/Wolverine/Runtime/MessageContext.cs +++ b/src/Wolverine/Runtime/MessageContext.cs @@ -446,6 +446,9 @@ internal void ClearState() internal void ReadEnvelope(Envelope? originalEnvelope, IChannelCallback channel) { Envelope = originalEnvelope ?? throw new ArgumentNullException(nameof(originalEnvelope)); + + originalEnvelope.MaybeCorrectReplyUri(); + CorrelationId = originalEnvelope.CorrelationId; ConversationId = originalEnvelope.Id; _channel = channel; diff --git a/src/Wolverine/Wolverine.csproj b/src/Wolverine/Wolverine.csproj index be8c0ccd7..2874a8bcc 100644 --- a/src/Wolverine/Wolverine.csproj +++ b/src/Wolverine/Wolverine.csproj @@ -4,7 +4,7 @@ WolverineFx - + From 0192976ad3f60a81f69adc4928259de91b7c509b Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 10:08:52 -0500 Subject: [PATCH 08/28] Disabling automatic failure acks by default. Finally. Closes GH-1578 --- src/Testing/CoreTests/Acceptance/remote_invocation.cs | 6 ++++++ src/Testing/CoreTests/Runtime/MoveToErrorQueueTester.cs | 2 ++ src/Testing/CoreTests/WolverineOptionsTests.cs | 4 ++-- src/Wolverine/WolverineOptions.cs | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Testing/CoreTests/Acceptance/remote_invocation.cs b/src/Testing/CoreTests/Acceptance/remote_invocation.cs index 91d7f5c69..88fd7697c 100644 --- a/src/Testing/CoreTests/Acceptance/remote_invocation.cs +++ b/src/Testing/CoreTests/Acceptance/remote_invocation.cs @@ -35,6 +35,8 @@ public async Task InitializeAsync() { opts.ServiceName = "Receiver1"; opts.ListenAtPort(_receiver1Port); + + opts.EnableAutomaticFailureAcks = true; }).StartAsync(); _receiver2 = await Host.CreateDefaultBuilder() @@ -42,6 +44,8 @@ public async Task InitializeAsync() { opts.ServiceName = "Receiver2"; opts.ListenAtPort(_receiver2Port); + + opts.EnableAutomaticFailureAcks = true; }).StartAsync(); _sender = await Host.CreateDefaultBuilder() @@ -57,6 +61,8 @@ public async Task InitializeAsync() opts.PublishMessage().ToPort(_receiver1Port); opts.PublishMessage().ToPort(_receiver2Port); + + opts.EnableAutomaticFailureAcks = true; }).StartAsync(); } diff --git a/src/Testing/CoreTests/Runtime/MoveToErrorQueueTester.cs b/src/Testing/CoreTests/Runtime/MoveToErrorQueueTester.cs index 5890196cb..a6d4fd5d2 100644 --- a/src/Testing/CoreTests/Runtime/MoveToErrorQueueTester.cs +++ b/src/Testing/CoreTests/Runtime/MoveToErrorQueueTester.cs @@ -23,6 +23,8 @@ public MoveToErrorQueueTester() [Fact] public async Task should_send_a_failure_ack_if_not_local() { + theRuntime.Options.EnableAutomaticFailureAcks = true; + theEnvelope.Destination = new Uri("tcp://localhost:9000"); await theContinuation.ExecuteAsync(theLifecycle, theRuntime, DateTimeOffset.Now, null); diff --git a/src/Testing/CoreTests/WolverineOptionsTests.cs b/src/Testing/CoreTests/WolverineOptionsTests.cs index dfd995265..9ed7051ec 100644 --- a/src/Testing/CoreTests/WolverineOptionsTests.cs +++ b/src/Testing/CoreTests/WolverineOptionsTests.cs @@ -26,9 +26,9 @@ public void publish_agent_events_should_be_false_by_default() } [Fact] - public void failure_acks_are_enabled_by_default() + public void failure_acks_are_NOT_enabled_by_default() { - new WolverineOptions().EnableAutomaticFailureAcks.ShouldBeTrue(); + new WolverineOptions().EnableAutomaticFailureAcks.ShouldBeFalse(); } [Fact] diff --git a/src/Wolverine/WolverineOptions.cs b/src/Wolverine/WolverineOptions.cs index 8c626ab66..8b824b6f8 100644 --- a/src/Wolverine/WolverineOptions.cs +++ b/src/Wolverine/WolverineOptions.cs @@ -191,9 +191,9 @@ public AutoCreate AutoBuildMessageStorageOnStartup /// /// Should message failures automatically try to send a failure acknowledgement message back to the - /// original caller. Default is true. + /// original caller. Default is *false* as of Wolverine 4.6 /// - public bool EnableAutomaticFailureAcks { get; set; } = true; + public bool EnableAutomaticFailureAcks { get; set; } = false; private void deriveServiceName() { From 4d162bc82b09dbc1d567602f932d9580f554828c Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 11:17:07 +0200 Subject: [PATCH 09/28] Add test --- .../Bugs/Bug_DLQ_NotSavedToDatabase.cs | 136 ++++++++++++++++++ .../Wolverine.RabbitMQ.Tests.csproj | 2 + 2 files changed, 138 insertions(+) create mode 100644 src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs new file mode 100644 index 000000000..bd1342f76 --- /dev/null +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs @@ -0,0 +1,136 @@ +// BUG REPRO: RabbitMQ DLQ not saved to DB when using WolverineStorage +// +// This test demonstrates that failed RabbitMQ messages are not written to the SQL Server DLQ +// because DurableReceiver.NativeDeadLetterQueueEnabled is always true, regardless of queue.DeadLetterQueue.Mode. +// See: src/Wolverine/Runtime/WorkerQueues/DurableReceiver.cs +// +// Key findings: +// - Even when configuring opts.UseRabbitMq().DisableDeadLetterQueueing(), +// so that queue.DeadLetterQueue.Mode == DeadLetterQueueMode.WolverineStorage, +// failed messages are NOT written to the DB DLQ. +// - This is because DurableReceiver.NativeDeadLetterQueueEnabled is hardcoded to true, +// so the wrong code path is taken in MoveToDeadLetterQueueAsync. +// - See the comments in the test and related code for more details. +// +// See also: https://github.com/JasperFx/wolverine/issues/ + +using System; +using System.Threading.Tasks; +using Dapper; +using IntegrationTests; +using JasperFx.Resources; +using Microsoft.Data.SqlClient; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Shouldly; +using Wolverine; +using Wolverine.Runtime; +using Wolverine.SqlServer; +using Xunit; + +namespace Wolverine.RabbitMQ.Tests.Bugs; + +public class Bug_DLQ_NotSavedToDatabase +{ + [Fact] + public async Task message_that_fails_in_handler_should_be_saved_to_sql_dlq_but_is_not() + { + var staticQueue = "static-test-queue"; + var instanceQueue = "instance-test-queue"; + var connectionString = Servers.SqlServerConnectionString; + + using var host = await Host.CreateDefaultBuilder() + .UseWolverine(opts => + { + opts.PersistMessagesWithSqlServer(connectionString, "wolverine"); + opts.Policies.AutoApplyTransactions(); + opts.EnableAutomaticFailureAcks = false; + opts.UseRabbitMq().DisableDeadLetterQueueing().AutoProvision(); + opts.Policies.UseDurableLocalQueues(); + opts.Policies.UseDurableInboxOnAllListeners(); + opts.Policies.UseDurableOutboxOnAllSendingEndpoints(); + opts.ListenToRabbitQueue(staticQueue); + opts.ListenToRabbitQueue(instanceQueue); + opts.PublishMessage().ToRabbitQueue(staticQueue); + opts.PublishMessage().ToRabbitQueue(instanceQueue); + opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + }).StartAsync(); + + await host.ResetResourceState(); + + // Debug print: check DeadLetterQueue and Mode for both queues + var runtime = host.Services.GetRequiredService(); + var transport = runtime.Options.RabbitMqTransport(); + var staticQ = transport.Queues[staticQueue]; + var instanceQ = transport.Queues[instanceQueue]; + Console.WriteLine($"staticQueue.DeadLetterQueue: {(staticQ.DeadLetterQueue == null ? "null" : staticQ.DeadLetterQueue.Mode.ToString())}"); + Console.WriteLine($"instanceQueue.DeadLetterQueue: {(instanceQ.DeadLetterQueue == null ? "null" : instanceQ.DeadLetterQueue.Mode.ToString())}"); + + // Print all tables in the current database for debugging + await using (var debugConn = new SqlConnection(connectionString)) + { + await debugConn.OpenAsync(); + var tables = await debugConn.QueryAsync( + "SELECT TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'"); + Console.WriteLine("Tables in database:"); + foreach (var table in tables) + { + Console.WriteLine(table); + } + } + + // Send messages to both queues using a scope + using (var scope = host.Services.CreateScope()) + { + var bus = scope.ServiceProvider.GetRequiredService(); + var staticMessage = new TestMessage { Id = Guid.NewGuid(), Content = "Static handler test message" }; + var instanceMessage = new TestMessage { Id = Guid.NewGuid(), Content = "Instance handler test message" }; + await bus.PublishAsync(staticMessage); + await bus.PublishAsync(instanceMessage); + + // Wait for processing + await Task.Delay(2000); + + // Check the DLQ table for the messages + await using var conn = new SqlConnection(connectionString); + await conn.OpenAsync(); + // Print the count and all entries in the DLQ table for debugging + var dlqCount = await conn.ExecuteScalarAsync("SELECT COUNT(*) FROM wolverine.wolverine_dead_letters"); + Console.WriteLine($"DLQ count: {dlqCount}"); + var allDeadLetters = await conn.QueryAsync($"SELECT * FROM wolverine.wolverine_dead_letters"); + foreach (var row in allDeadLetters) + { + Console.WriteLine(row); + } + var staticDeadLetter = await conn.QueryFirstOrDefaultAsync($"SELECT * FROM wolverine.wolverine_dead_letters WHERE body LIKE '%{staticMessage.Id}%'"); + var instanceDeadLetter = await conn.QueryFirstOrDefaultAsync($"SELECT * FROM wolverine.wolverine_dead_letters WHERE body LIKE '%{instanceMessage.Id}%'"); + + // Assert: These should NOT be null if DLQ is working + staticDeadLetter.ShouldNotBeNull("Static handler message should be in SQL DLQ"); + instanceDeadLetter.ShouldNotBeNull("Instance handler message should be in SQL DLQ"); + } + } + + // Handler that always throws to force DLQ + public class StaticTestHandler + { + public static Task Handle(TestMessage message) + { + throw new InvalidOperationException($"Simulated error for message {message.Id} in STATIC handler"); + } + } + + public class InstanceTestHandler + { + public Task Handle(TestMessage message) + { + throw new InvalidOperationException($"Simulated error for message {message.Id} in INSTANCE handler"); + } + } + + public record TestMessage + { + public Guid Id { get; init; } + public string Content { get; init; } = string.Empty; + } +} \ No newline at end of file diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj index c05c34719..0d7d8b2e3 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj @@ -12,12 +12,14 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + From 4cc116b5a980e1867162e1d1b4691f0a0fd25dcf Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 11:25:41 +0200 Subject: [PATCH 10/28] Add logging --- .../Bugs/Bug_DLQ_NotSavedToDatabase.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs index bd1342f76..c03391c0f 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs @@ -27,11 +27,19 @@ using Wolverine.Runtime; using Wolverine.SqlServer; using Xunit; +using Xunit.Abstractions; namespace Wolverine.RabbitMQ.Tests.Bugs; public class Bug_DLQ_NotSavedToDatabase { + private readonly ITestOutputHelper _output; + + public Bug_DLQ_NotSavedToDatabase(ITestOutputHelper output) + { + _output = output; + } + [Fact] public async Task message_that_fails_in_handler_should_be_saved_to_sql_dlq_but_is_not() { @@ -63,8 +71,8 @@ public async Task message_that_fails_in_handler_should_be_saved_to_sql_dlq_but_i var transport = runtime.Options.RabbitMqTransport(); var staticQ = transport.Queues[staticQueue]; var instanceQ = transport.Queues[instanceQueue]; - Console.WriteLine($"staticQueue.DeadLetterQueue: {(staticQ.DeadLetterQueue == null ? "null" : staticQ.DeadLetterQueue.Mode.ToString())}"); - Console.WriteLine($"instanceQueue.DeadLetterQueue: {(instanceQ.DeadLetterQueue == null ? "null" : instanceQ.DeadLetterQueue.Mode.ToString())}"); + _output.WriteLine($"staticQueue.DeadLetterQueue: {(staticQ.DeadLetterQueue == null ? "null" : staticQ.DeadLetterQueue.Mode.ToString())}"); + _output.WriteLine($"instanceQueue.DeadLetterQueue: {(instanceQ.DeadLetterQueue == null ? "null" : instanceQ.DeadLetterQueue.Mode.ToString())}"); // Print all tables in the current database for debugging await using (var debugConn = new SqlConnection(connectionString)) @@ -72,10 +80,10 @@ public async Task message_that_fails_in_handler_should_be_saved_to_sql_dlq_but_i await debugConn.OpenAsync(); var tables = await debugConn.QueryAsync( "SELECT TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'"); - Console.WriteLine("Tables in database:"); + _output.WriteLine("Tables in database:"); foreach (var table in tables) { - Console.WriteLine(table); + _output.WriteLine(table); } } @@ -96,11 +104,11 @@ public async Task message_that_fails_in_handler_should_be_saved_to_sql_dlq_but_i await conn.OpenAsync(); // Print the count and all entries in the DLQ table for debugging var dlqCount = await conn.ExecuteScalarAsync("SELECT COUNT(*) FROM wolverine.wolverine_dead_letters"); - Console.WriteLine($"DLQ count: {dlqCount}"); + _output.WriteLine($"DLQ count: {dlqCount}"); var allDeadLetters = await conn.QueryAsync($"SELECT * FROM wolverine.wolverine_dead_letters"); foreach (var row in allDeadLetters) { - Console.WriteLine(row); + _output.WriteLine(row.ToString()); } var staticDeadLetter = await conn.QueryFirstOrDefaultAsync($"SELECT * FROM wolverine.wolverine_dead_letters WHERE body LIKE '%{staticMessage.Id}%'"); var instanceDeadLetter = await conn.QueryFirstOrDefaultAsync($"SELECT * FROM wolverine.wolverine_dead_letters WHERE body LIKE '%{instanceMessage.Id}%'"); From 1ca64fbe81710287b5f55ad78ff0dbc99804d284 Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 19:18:18 +0200 Subject: [PATCH 11/28] Adjust test --- .../Bugs/Bug_DLQ_NotSavedToDatabase.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs index c03391c0f..3ec669398 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs @@ -97,7 +97,7 @@ public async Task message_that_fails_in_handler_should_be_saved_to_sql_dlq_but_i await bus.PublishAsync(instanceMessage); // Wait for processing - await Task.Delay(2000); + await Task.Delay(30000); // Check the DLQ table for the messages await using var conn = new SqlConnection(connectionString); @@ -110,12 +110,7 @@ public async Task message_that_fails_in_handler_should_be_saved_to_sql_dlq_but_i { _output.WriteLine(row.ToString()); } - var staticDeadLetter = await conn.QueryFirstOrDefaultAsync($"SELECT * FROM wolverine.wolverine_dead_letters WHERE body LIKE '%{staticMessage.Id}%'"); - var instanceDeadLetter = await conn.QueryFirstOrDefaultAsync($"SELECT * FROM wolverine.wolverine_dead_letters WHERE body LIKE '%{instanceMessage.Id}%'"); - - // Assert: These should NOT be null if DLQ is working - staticDeadLetter.ShouldNotBeNull("Static handler message should be in SQL DLQ"); - instanceDeadLetter.ShouldNotBeNull("Instance handler message should be in SQL DLQ"); + allDeadLetters.ShouldNotBeEmpty(); } } From bd5f48ef2ae672e7cd394f7701552aca7ccbb977 Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 20:05:18 +0200 Subject: [PATCH 12/28] Add more tests, durable queues fails --- .../Bugs/Bug_DLQ_NotSavedToDatabase.cs | 179 ++++++++++++++---- 1 file changed, 139 insertions(+), 40 deletions(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs index 3ec669398..0382eaf0e 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs @@ -31,103 +31,202 @@ namespace Wolverine.RabbitMQ.Tests.Bugs; -public class Bug_DLQ_NotSavedToDatabase +public class Bug_DLQ_NotSavedToDatabase : IDisposable { private readonly ITestOutputHelper _output; + private IHost _host; public Bug_DLQ_NotSavedToDatabase(ITestOutputHelper output) { _output = output; } + public void Dispose() + { + // Try to eliminate queues to keep them from accumulating + _host?.TeardownResources(); + _host?.Dispose(); + } + + [Fact] + public async Task test_1_durable_inbox_should_save_failed_messages_to_sql_dlq() + { + var queueName = $"durable-inbox-{Guid.NewGuid()}"; + var connectionString = Servers.SqlServerConnectionString; + + _host = await Host.CreateDefaultBuilder() + .UseWolverine(opts => + { + opts.PersistMessagesWithSqlServer(connectionString, "wolverine"); + opts.Policies.AutoApplyTransactions(); + opts.EnableAutomaticFailureAcks = false; + opts.UseRabbitMq().DisableDeadLetterQueueing().AutoProvision().AutoPurgeOnStartup(); + opts.ListenToRabbitQueue(queueName).UseDurableInbox(); + opts.PublishMessage().ToRabbitQueue(queueName); + opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + }).StartAsync(); + + await _host.ResetResourceState(); + + // Debug print: check DeadLetterQueue and Mode + var runtime = _host.Services.GetRequiredService(); + var transport = runtime.Options.RabbitMqTransport(); + var queue = transport.Queues[queueName]; + _output.WriteLine($"Queue '{queueName}'.DeadLetterQueue: {(queue.DeadLetterQueue == null ? "null" : queue.DeadLetterQueue.Mode.ToString())}"); + + // Send message and verify DLQ behavior + await SendMessageAndCheckDLQ(_host, connectionString, queueName, "durable inbox test"); + } + + [Fact] + public async Task test_2_non_durable_inbox_should_save_failed_messages_to_sql_dlq() + { + var queueName = $"non-durable-inbox-{Guid.NewGuid()}"; + var connectionString = Servers.SqlServerConnectionString; + + _host = await Host.CreateDefaultBuilder() + .UseWolverine(opts => + { + opts.PersistMessagesWithSqlServer(connectionString, "wolverine"); + opts.Policies.AutoApplyTransactions(); + opts.EnableAutomaticFailureAcks = false; + opts.UseRabbitMq().DisableDeadLetterQueueing().AutoProvision().AutoPurgeOnStartup(); + opts.ListenToRabbitQueue(queueName); // No UseDurableInbox() + opts.PublishMessage().ToRabbitQueue(queueName); + opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + }).StartAsync(); + + await _host.ResetResourceState(); + + // Debug print: check DeadLetterQueue and Mode + var runtime = _host.Services.GetRequiredService(); + var transport = runtime.Options.RabbitMqTransport(); + var queue = transport.Queues[queueName]; + _output.WriteLine($"Queue '{queueName}'.DeadLetterQueue: {(queue.DeadLetterQueue == null ? "null" : queue.DeadLetterQueue.Mode.ToString())}"); + + // Send message and verify DLQ behavior + await SendMessageAndCheckDLQ(_host, connectionString, queueName, "non-durable inbox test"); + } + [Fact] - public async Task message_that_fails_in_handler_should_be_saved_to_sql_dlq_but_is_not() + public async Task test_3_global_durable_configs_should_save_failed_messages_to_sql_dlq() { - var staticQueue = "static-test-queue"; - var instanceQueue = "instance-test-queue"; + var queueName = $"global-durable-configs-{Guid.NewGuid()}"; var connectionString = Servers.SqlServerConnectionString; - using var host = await Host.CreateDefaultBuilder() + _host = await Host.CreateDefaultBuilder() .UseWolverine(opts => { opts.PersistMessagesWithSqlServer(connectionString, "wolverine"); opts.Policies.AutoApplyTransactions(); opts.EnableAutomaticFailureAcks = false; - opts.UseRabbitMq().DisableDeadLetterQueueing().AutoProvision(); + opts.UseRabbitMq().DisableDeadLetterQueueing().AutoProvision().AutoPurgeOnStartup(); + + // Global durable configs opts.Policies.UseDurableLocalQueues(); opts.Policies.UseDurableInboxOnAllListeners(); opts.Policies.UseDurableOutboxOnAllSendingEndpoints(); - opts.ListenToRabbitQueue(staticQueue); - opts.ListenToRabbitQueue(instanceQueue); - opts.PublishMessage().ToRabbitQueue(staticQueue); - opts.PublishMessage().ToRabbitQueue(instanceQueue); + + opts.ListenToRabbitQueue(queueName); + opts.PublishMessage().ToRabbitQueue(queueName); opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); }).StartAsync(); - await host.ResetResourceState(); + await _host.ResetResourceState(); - // Debug print: check DeadLetterQueue and Mode for both queues - var runtime = host.Services.GetRequiredService(); + // Debug print: check DeadLetterQueue and Mode + var runtime = _host.Services.GetRequiredService(); var transport = runtime.Options.RabbitMqTransport(); - var staticQ = transport.Queues[staticQueue]; - var instanceQ = transport.Queues[instanceQueue]; - _output.WriteLine($"staticQueue.DeadLetterQueue: {(staticQ.DeadLetterQueue == null ? "null" : staticQ.DeadLetterQueue.Mode.ToString())}"); - _output.WriteLine($"instanceQueue.DeadLetterQueue: {(instanceQ.DeadLetterQueue == null ? "null" : instanceQ.DeadLetterQueue.Mode.ToString())}"); + var queue = transport.Queues[queueName]; + _output.WriteLine($"Queue '{queueName}'.DeadLetterQueue: {(queue.DeadLetterQueue == null ? "null" : queue.DeadLetterQueue.Mode.ToString())}"); + + // Send message and verify DLQ behavior + await SendMessageAndCheckDLQ(_host, connectionString, queueName, "global durable configs test"); + } + // [Fact] + // public async Task test_4_quorum_with_global_configs_should_save_failed_messages_to_sql_dlq() + // { + // var queueName = $"quorum-global-configs-{Guid.NewGuid()}"; + // var connectionString = Servers.SqlServerConnectionString; + // + // _host = await Host.CreateDefaultBuilder() + // .UseWolverine(opts => + // { + // opts.PersistMessagesWithSqlServer(connectionString, "wolverine"); + // opts.Policies.AutoApplyTransactions(); + // opts.EnableAutomaticFailureAcks = false; + // opts.UseRabbitMq().DisableDeadLetterQueueing().AutoProvision().AutoPurgeOnStartup().UseQuorumQueues(); + // + // // Global durable configs + // opts.Policies.UseDurableLocalQueues(); + // opts.Policies.UseDurableInboxOnAllListeners(); + // opts.Policies.UseDurableOutboxOnAllSendingEndpoints(); + // + // opts.ListenToRabbitQueue(queueName); + // opts.PublishMessage().ToRabbitQueue(queueName); + // opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + // }).StartAsync(); + // + // await _host.ResetResourceState(); + // + // // Debug print: check DeadLetterQueue and Mode + // var runtime = _host.Services.GetRequiredService(); + // var transport = runtime.Options.RabbitMqTransport(); + // var queue = transport.Queues[queueName]; + // _output.WriteLine($"Queue '{queueName}'.DeadLetterQueue: {(queue.DeadLetterQueue == null ? "null" : queue.DeadLetterQueue.Mode.ToString())}"); + // + // // Send message and verify DLQ behavior + // await SendMessageAndCheckDLQ(_host, connectionString, queueName, "quorum with global configs test"); + // } + + private async Task SendMessageAndCheckDLQ(IHost host, string connectionString, string queueName, string testDescription) + { // Print all tables in the current database for debugging await using (var debugConn = new SqlConnection(connectionString)) { await debugConn.OpenAsync(); var tables = await debugConn.QueryAsync( "SELECT TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'"); - _output.WriteLine("Tables in database:"); + _output.WriteLine($"Tables in database for {testDescription}:"); foreach (var table in tables) { _output.WriteLine(table); } } - // Send messages to both queues using a scope + // Send message using a scope using (var scope = host.Services.CreateScope()) { var bus = scope.ServiceProvider.GetRequiredService(); - var staticMessage = new TestMessage { Id = Guid.NewGuid(), Content = "Static handler test message" }; - var instanceMessage = new TestMessage { Id = Guid.NewGuid(), Content = "Instance handler test message" }; - await bus.PublishAsync(staticMessage); - await bus.PublishAsync(instanceMessage); + var message = new TestMessage { Id = Guid.NewGuid(), Content = $"{testDescription} message" }; + await bus.PublishAsync(message); // Wait for processing - await Task.Delay(30000); + await Task.Delay(5000); - // Check the DLQ table for the messages + // Check the DLQ table for the message await using var conn = new SqlConnection(connectionString); await conn.OpenAsync(); + // Print the count and all entries in the DLQ table for debugging var dlqCount = await conn.ExecuteScalarAsync("SELECT COUNT(*) FROM wolverine.wolverine_dead_letters"); - _output.WriteLine($"DLQ count: {dlqCount}"); + _output.WriteLine($"DLQ count for {testDescription}: {dlqCount}"); + var allDeadLetters = await conn.QueryAsync($"SELECT * FROM wolverine.wolverine_dead_letters"); - foreach (var row in allDeadLetters) - { - _output.WriteLine(row.ToString()); - } + _output.WriteLine($"All dead letters for {testDescription}: {allDeadLetters.ToList().Count} entries"); + + // This should contain the failed message, but currently doesn't due to the bug allDeadLetters.ShouldNotBeEmpty(); } } // Handler that always throws to force DLQ - public class StaticTestHandler + public class TestHandler { public static Task Handle(TestMessage message) { - throw new InvalidOperationException($"Simulated error for message {message.Id} in STATIC handler"); - } - } - - public class InstanceTestHandler - { - public Task Handle(TestMessage message) - { - throw new InvalidOperationException($"Simulated error for message {message.Id} in INSTANCE handler"); + throw new InvalidOperationException($"Simulated error for message {message.Id}"); } } From db6e1b04f75e8ededc71eb8a10f553846f2fc115 Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 20:09:53 +0200 Subject: [PATCH 13/28] Use IMessageStore.Admin --- .../Bugs/Bug_DLQ_NotSavedToDatabase.cs | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs index 0382eaf0e..1eb00ac36 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs @@ -26,6 +26,8 @@ using Wolverine; using Wolverine.Runtime; using Wolverine.SqlServer; +using Wolverine.Persistence.Durability; +using Wolverine.Persistence.Durability.DeadLetterManagement; using Xunit; using Xunit.Abstractions; @@ -182,18 +184,12 @@ public async Task test_3_global_durable_configs_should_save_failed_messages_to_s private async Task SendMessageAndCheckDLQ(IHost host, string connectionString, string queueName, string testDescription) { - // Print all tables in the current database for debugging - await using (var debugConn = new SqlConnection(connectionString)) - { - await debugConn.OpenAsync(); - var tables = await debugConn.QueryAsync( - "SELECT TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'"); - _output.WriteLine($"Tables in database for {testDescription}:"); - foreach (var table in tables) - { - _output.WriteLine(table); - } - } + // Get the message store from the host + var messageStore = host.Services.GetRequiredService(); + + // Print counts before sending message + var initialCounts = await messageStore.Admin.FetchCountsAsync(); + _output.WriteLine($"Initial counts for {testDescription}: Incoming={initialCounts.Incoming}, Outgoing={initialCounts.Outgoing}, DeadLetter={initialCounts.DeadLetter}"); // Send message using a scope using (var scope = host.Services.CreateScope()) @@ -205,19 +201,21 @@ private async Task SendMessageAndCheckDLQ(IHost host, string connectionString, s // Wait for processing await Task.Delay(5000); - // Check the DLQ table for the message - await using var conn = new SqlConnection(connectionString); - await conn.OpenAsync(); + // Check the DLQ using Wolverine's API instead of raw SQL + var finalCounts = await messageStore.Admin.FetchCountsAsync(); + _output.WriteLine($"Final counts for {testDescription}: Incoming={finalCounts.Incoming}, Outgoing={finalCounts.Outgoing}, DeadLetter={finalCounts.DeadLetter}"); - // Print the count and all entries in the DLQ table for debugging - var dlqCount = await conn.ExecuteScalarAsync("SELECT COUNT(*) FROM wolverine.wolverine_dead_letters"); - _output.WriteLine($"DLQ count for {testDescription}: {dlqCount}"); + // Query dead letters using Wolverine's API + var deadLetterQuery = new DeadLetterEnvelopeQueryParameters + { + Limit = 100 + }; + var deadLetterResults = await messageStore.DeadLetters.QueryDeadLetterEnvelopesAsync(deadLetterQuery); - var allDeadLetters = await conn.QueryAsync($"SELECT * FROM wolverine.wolverine_dead_letters"); - _output.WriteLine($"All dead letters for {testDescription}: {allDeadLetters.ToList().Count} entries"); + _output.WriteLine($"Dead letter results for {testDescription}: {deadLetterResults.DeadLetterEnvelopes.Count} entries"); // This should contain the failed message, but currently doesn't due to the bug - allDeadLetters.ShouldNotBeEmpty(); + deadLetterResults.DeadLetterEnvelopes.ShouldNotBeEmpty(); } } From b9a658acccd60105112fd3a951e8247fbd196559 Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 20:12:39 +0200 Subject: [PATCH 14/28] Remove dapper --- .../Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj index 0d7d8b2e3..631e482e8 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Wolverine.RabbitMQ.Tests.csproj @@ -12,7 +12,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - From 3d8542dc034975d73e7ca48e9627dd902d19ff5d Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 21:04:46 +0200 Subject: [PATCH 15/28] Update tests --- .../Bugs/Bug_DLQ_NotSavedToDatabase.cs | 162 ++++++++++++++++-- 1 file changed, 150 insertions(+), 12 deletions(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs index 1eb00ac36..7808a67d2 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs @@ -1,22 +1,24 @@ -// BUG REPRO: RabbitMQ DLQ not saved to DB when using WolverineStorage +// BUG REPRO: RabbitMQ DLQ behavior investigation // -// This test demonstrates that failed RabbitMQ messages are not written to the SQL Server DLQ -// because DurableReceiver.NativeDeadLetterQueueEnabled is always true, regardless of queue.DeadLetterQueue.Mode. -// See: src/Wolverine/Runtime/WorkerQueues/DurableReceiver.cs +// This test investigates the behavior of failed RabbitMQ messages when using different DLQ configurations. +// The current behavior shows that messages are not written to the SQL Server DLQ when using .DisableDeadLetterQueueing(). // -// Key findings: -// - Even when configuring opts.UseRabbitMq().DisableDeadLetterQueueing(), +// Current behavior: +// - When configuring opts.UseRabbitMq().DisableDeadLetterQueueing(), // so that queue.DeadLetterQueue.Mode == DeadLetterQueueMode.WolverineStorage, // failed messages are NOT written to the DB DLQ. -// - This is because DurableReceiver.NativeDeadLetterQueueEnabled is hardcoded to true, -// so the wrong code path is taken in MoveToDeadLetterQueueAsync. -// - See the comments in the test and related code for more details. +// - This appears to be because RabbitMqQueue.TryBuildDeadLetterSender always returns true, +// causing DurableReceiver._deadLetterSender to always be non-null. +// - As a result, DurableReceiver.MoveToErrorsAsync always takes the RabbitMQ DLQ path +// instead of the SQL Server DLQ path. +// +// Investigation: This test demonstrates the current behavior and investigates whether +// this is the intended design or if there's a configuration issue. // // See also: https://github.com/JasperFx/wolverine/issues/ using System; using System.Threading.Tasks; -using Dapper; using IntegrationTests; using JasperFx.Resources; using Microsoft.Data.SqlClient; @@ -28,6 +30,9 @@ using Wolverine.SqlServer; using Wolverine.Persistence.Durability; using Wolverine.Persistence.Durability.DeadLetterManagement; +using Wolverine.RabbitMQ; +using Wolverine.RabbitMQ.Internal; +using Wolverine.Transports.Sending; using Xunit; using Xunit.Abstractions; @@ -182,11 +187,139 @@ public async Task test_3_global_durable_configs_should_save_failed_messages_to_s // await SendMessageAndCheckDLQ(_host, connectionString, queueName, "quorum with global configs test"); // } + + + [Fact] + public async Task test_5_verify_try_build_dead_letter_sender_behavior() + { + var connectionString = Servers.SqlServerConnectionString; + + _host = await Host.CreateDefaultBuilder() + .UseWolverine(opts => + { + opts.PersistMessagesWithSqlServer(connectionString, "wolverine"); + opts.Policies.AutoApplyTransactions(); + opts.EnableAutomaticFailureAcks = false; + opts.UseRabbitMq().DisableDeadLetterQueueing().AutoProvision().AutoPurgeOnStartup(); + opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + }).StartAsync(); + + await _host.ResetResourceState(); + + var runtime = _host.Services.GetRequiredService(); + var transport = runtime.Options.RabbitMqTransport(); + + // Test 1: Queue with WolverineStorage mode + var queue1 = new RabbitMqQueue("test-queue-1", transport); + queue1.DeadLetterQueue = new DeadLetterQueue("test-dlq-1", DeadLetterQueueMode.WolverineStorage); + + var hasDeadLetterSender1 = queue1.TryBuildDeadLetterSender(runtime, out var deadLetterSender1); + _output.WriteLine($"Queue with WolverineStorage mode - TryBuildDeadLetterSender: {hasDeadLetterSender1}, sender null: {deadLetterSender1 == null}"); + + // Assert that TryBuildDeadLetterSender should return false for WolverineStorage mode + // This test will fail, demonstrating the bug + hasDeadLetterSender1.ShouldBeFalse("TryBuildDeadLetterSender should return false for WolverineStorage mode to allow SQL Server DLQ path"); + deadLetterSender1.ShouldBeNull("Dead letter sender should be null for WolverineStorage mode"); + + // Test 2: Queue with Native mode + var queue2 = new RabbitMqQueue("test-queue-2", transport); + queue2.DeadLetterQueue = new DeadLetterQueue("test-dlq-2", DeadLetterQueueMode.Native); + + var hasDeadLetterSender2 = queue2.TryBuildDeadLetterSender(runtime, out var deadLetterSender2); + _output.WriteLine($"Queue with Native mode - TryBuildDeadLetterSender: {hasDeadLetterSender2}, sender null: {deadLetterSender2 == null}"); + + // This should be true for Native mode + hasDeadLetterSender2.ShouldBeTrue("TryBuildDeadLetterSender should return true for Native mode"); + deadLetterSender2.ShouldNotBeNull("Dead letter sender should not be null for Native mode"); + + // Test 3: Queue with no dead letter queue + var queue3 = new RabbitMqQueue("test-queue-3", transport); + queue3.DeadLetterQueue = null; + + var hasDeadLetterSender3 = queue3.TryBuildDeadLetterSender(runtime, out var deadLetterSender3); + _output.WriteLine($"Queue with no DLQ - TryBuildDeadLetterSender: {hasDeadLetterSender3}, sender null: {deadLetterSender3 == null}"); + + // This should be false when no DLQ is configured + hasDeadLetterSender3.ShouldBeFalse("TryBuildDeadLetterSender should return false when no DLQ is configured"); + deadLetterSender3.ShouldBeNull("Dead letter sender should be null when no DLQ is configured"); + + // Summary of findings + _output.WriteLine(""); + _output.WriteLine("Summary:"); + _output.WriteLine("- TryBuildDeadLetterSender returns true for all modes (WolverineStorage, Native, and no DLQ)"); + _output.WriteLine("- This means DurableReceiver._deadLetterSender is always non-null"); + _output.WriteLine("- As a result, DurableReceiver.MoveToErrorsAsync always uses the RabbitMQ DLQ path"); + _output.WriteLine("- The SQL Server DLQ path is never taken, regardless of DeadLetterQueueMode"); + } + + [Fact] + public async Task test_6_demonstrate_durable_receiver_decision_logic_issue() + { + var queueName = $"decision-logic-test-{Guid.NewGuid()}"; + var connectionString = Servers.SqlServerConnectionString; + + _output.WriteLine($"Starting decision logic test with queue: {queueName}"); + + _host = await Host.CreateDefaultBuilder() + .UseWolverine(opts => + { + opts.PersistMessagesWithSqlServer(connectionString, "wolverine"); + opts.Policies.AutoApplyTransactions(); + opts.EnableAutomaticFailureAcks = false; + opts.UseRabbitMq().DisableDeadLetterQueueing().AutoProvision().AutoPurgeOnStartup(); + opts.ListenToRabbitQueue(queueName); + opts.PublishMessage().ToRabbitQueue(queueName); + opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + }).StartAsync(); + + await _host.ResetResourceState(); + + var runtime = _host.Services.GetRequiredService(); + var transport = runtime.Options.RabbitMqTransport(); + var queue = transport.Queues[queueName]; + + _output.WriteLine($"Queue '{queueName}'.DeadLetterQueue: {(queue.DeadLetterQueue == null ? "null" : queue.DeadLetterQueue.Mode.ToString())}"); + + // Verify that TryBuildDeadLetterSender returns true + // even when DeadLetterQueueMode.WolverineStorage is configured + var hasDeadLetterSender = queue.TryBuildDeadLetterSender(runtime, out var deadLetterSender); + _output.WriteLine($"TryBuildDeadLetterSender returned: {hasDeadLetterSender}, sender is null: {deadLetterSender == null}"); + + // Assert that TryBuildDeadLetterSender should return false for WolverineStorage mode + // This test will fail, demonstrating the bug + hasDeadLetterSender.ShouldBeFalse("TryBuildDeadLetterSender should return false for WolverineStorage mode to allow SQL Server DLQ path"); + deadLetterSender.ShouldBeNull("Dead letter sender should be null for WolverineStorage mode"); + + // This demonstrates the decision logic in DurableReceiver.MoveToErrorsAsync + _output.WriteLine(""); + _output.WriteLine("DurableReceiver.MoveToErrorsAsync decision logic:"); + _output.WriteLine("if (_deadLetterSender != null) {"); + _output.WriteLine(" await _deadLetterSender.SendAsync(envelope); // RabbitMQ DLQ path"); + _output.WriteLine(" return;"); + _output.WriteLine("}"); + _output.WriteLine("// SQL Server DLQ path"); + _output.WriteLine("await _inbox.MoveToDeadLetterStorageAsync(report.Envelope, report.Exception);"); + _output.WriteLine(""); + _output.WriteLine($"Since _deadLetterSender is {(deadLetterSender == null ? "null" : "non-null")}, the code will take the {(deadLetterSender == null ? "SQL Server DLQ" : "RabbitMQ DLQ")} path."); + _output.WriteLine(""); + _output.WriteLine("The bug is that TryBuildDeadLetterSender returns true for WolverineStorage mode,"); + _output.WriteLine("causing the RabbitMQ DLQ path to always be taken instead of the SQL Server DLQ path."); + } + private async Task SendMessageAndCheckDLQ(IHost host, string connectionString, string queueName, string testDescription) { // Get the message store from the host var messageStore = host.Services.GetRequiredService(); + // Debug: Check if a dead letter sender was created + var runtime = host.Services.GetRequiredService(); + var transport = runtime.Options.RabbitMqTransport(); + var queue = transport.Queues[queueName]; + + // Try to build a dead letter sender to see what happens + var hasDeadLetterSender = queue.TryBuildDeadLetterSender(runtime, out var deadLetterSender); + _output.WriteLine($"Queue '{queueName}' TryBuildDeadLetterSender returned: {hasDeadLetterSender}, sender is null: {deadLetterSender == null}"); + // Print counts before sending message var initialCounts = await messageStore.Admin.FetchCountsAsync(); _output.WriteLine($"Initial counts for {testDescription}: Incoming={initialCounts.Incoming}, Outgoing={initialCounts.Outgoing}, DeadLetter={initialCounts.DeadLetter}"); @@ -214,8 +347,13 @@ private async Task SendMessageAndCheckDLQ(IHost host, string connectionString, s _output.WriteLine($"Dead letter results for {testDescription}: {deadLetterResults.DeadLetterEnvelopes.Count} entries"); - // This should contain the failed message, but currently doesn't due to the bug - deadLetterResults.DeadLetterEnvelopes.ShouldNotBeEmpty(); + // Document the current behavior - the DLQ is empty + _output.WriteLine($"Current behavior: SQL Server DLQ contains {deadLetterResults.DeadLetterEnvelopes.Count} messages"); + _output.WriteLine("Note: The message appears to have been sent to the RabbitMQ DLQ instead of the SQL Server DLQ"); + + // Assert that we should have DLQ entries in SQL Server when using WolverineStorage mode + // This test will fail, demonstrating the current bug + deadLetterResults.DeadLetterEnvelopes.ShouldNotBeEmpty($"When using DeadLetterQueueMode.WolverineStorage, failed messages should be saved to the SQL Server DLQ, but found {deadLetterResults.DeadLetterEnvelopes.Count} entries"); } } From 4a5a36b2cbcc885adefe795ba255344ebe829935 Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 21:26:20 +0200 Subject: [PATCH 16/28] Seperate test suite --- ...ine_storage_dead_letter_queue_mechanics.cs | 182 ++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/wolverine_storage_dead_letter_queue_mechanics.cs diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/wolverine_storage_dead_letter_queue_mechanics.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/wolverine_storage_dead_letter_queue_mechanics.cs new file mode 100644 index 000000000..5f845b73d --- /dev/null +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/wolverine_storage_dead_letter_queue_mechanics.cs @@ -0,0 +1,182 @@ +using JasperFx.Core; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using JasperFx.Resources; +using Shouldly; +using Wolverine.RabbitMQ.Internal; +using Wolverine.Runtime; +using Wolverine.Tracking; +using Wolverine.SqlServer; +using Wolverine.Persistence.Durability.DeadLetterManagement; +using Xunit; +using IntegrationTests; +using Wolverine.Persistence.Durability; + +namespace Wolverine.RabbitMQ.Tests; + +public class wolverine_storage_dead_letter_queue_mechanics : IDisposable +{ + private readonly string QueueName = Guid.NewGuid().ToString(); + private IHost _host; + private RabbitMqTransport theTransport; + private readonly string connectionString; + + public wolverine_storage_dead_letter_queue_mechanics() + { + connectionString = Servers.SqlServerConnectionString; + } + + public async Task afterBootstrapping() + { + await CreateHost(QueueName, useDurableInbox: false); + } + + private async Task CreateHost(string queueName, bool useDurableInbox = false) + { + _host = await Host.CreateDefaultBuilder() + .UseWolverine(opts => + { + opts.PersistMessagesWithSqlServer(connectionString, "wolverine"); + opts.Policies.AutoApplyTransactions(); + opts.EnableAutomaticFailureAcks = false; + opts.UseRabbitMq().AutoProvision().AutoPurgeOnStartup().DisableDeadLetterQueueing(); + + if (useDurableInbox) + { + opts.ListenToRabbitQueue(queueName).UseDurableInbox(); + opts.PublishMessage().ToRabbitQueue(queueName); + } + else + { + opts.PublishAllMessages().ToRabbitQueue(queueName); + opts.ListenToRabbitQueue(queueName); + } + + opts.LocalRoutingConventionDisabled = true; + opts.Services.AddResourceSetupOnStartup(StartupAction.ResetState); + }).StartAsync(); + + await _host.ResetResourceState(); + + theTransport = _host + .Services + .GetRequiredService() + .Options + .Transports + .GetOrCreate(); + } + + public void Dispose() + { + // Try to eliminate queues to keep them from accumulating + _host?.TeardownResources(); + _host?.Dispose(); + } + + [Fact] + public async Task should_not_have_native_dead_letter_objects_when_disabled() + { + await afterBootstrapping(); + + theTransport.Exchanges.Contains(RabbitMqTransport.DeadLetterQueueName).ShouldBeFalse(); + theTransport.Queues.Contains(RabbitMqTransport.DeadLetterQueueName).ShouldBeFalse(); + } + + [Fact] + public async Task should_not_set_dead_letter_queue_exchange_on_created_queues() + { + await afterBootstrapping(); + + var queue = theTransport.Queues[QueueName]; + + queue.Arguments.ContainsKey(RabbitMqTransport.DeadLetterQueueHeader).ShouldBeFalse(); + } + + [Fact] + public async Task should_have_wolverine_storage_mode() + { + await afterBootstrapping(); + + var queue = theTransport.Queues[QueueName]; + queue.DeadLetterQueue?.Mode.ShouldBe(DeadLetterQueueMode.WolverineStorage); + } + + [Fact] + public async Task should_save_failed_messages_to_sql_server_dlq() + { + await afterBootstrapping(); + + // Send a message that will fail + await _host.TrackActivity().DoNotAssertOnExceptionsDetected().PublishMessageAndWaitAsync(new WolverineStorageTestMessage()); + + // Wait a bit for processing + await Task.Delay(1000); + + // Check that the message is in the SQL Server DLQ + var messageStore = _host.Services.GetRequiredService(); + var deadLetterQuery = new DeadLetterEnvelopeQueryParameters + { + Limit = 100 + }; + var deadLetterResults = await messageStore.DeadLetters.QueryDeadLetterEnvelopesAsync(deadLetterQuery); + + // Should have at least one dead letter message + deadLetterResults.DeadLetterEnvelopes.ShouldNotBeEmpty("Failed messages should be saved to SQL Server DLQ when using WolverineStorage mode"); + + // Verify the message details + var deadLetter = deadLetterResults.DeadLetterEnvelopes.First(); + deadLetter.ExceptionType.ShouldBe(typeof(DivideByZeroException).FullName); + deadLetter.ExceptionMessage.ShouldBe("Boom."); + } + + [Fact] + public async Task should_not_have_messages_in_rabbitmq_dlq() + { + await afterBootstrapping(); + + // Send a message that will fail + await _host.TrackActivity().DoNotAssertOnExceptionsDetected().PublishMessageAndWaitAsync(new WolverineStorageTestMessage()); + + // Wait a bit for processing + await Task.Delay(1000); + + // Check that there are no messages in any RabbitMQ DLQ + // Since we disabled dead letter queueing, there shouldn't be any DLQ + theTransport.Queues.Contains(RabbitMqTransport.DeadLetterQueueName).ShouldBeFalse(); + } + + [Fact] + public async Task should_work_with_durable_inbox() + { + var durableQueueName = $"durable-{Guid.NewGuid()}"; + + await CreateHost(durableQueueName, useDurableInbox: true); + + // Send a message that will fail + await _host.TrackActivity().DoNotAssertOnExceptionsDetected().PublishMessageAndWaitAsync(new WolverineStorageTestMessage()); + + // Wait a bit for processing + await Task.Delay(1000); + + // Check that the message is in the SQL Server DLQ + var messageStore = _host.Services.GetRequiredService(); + var deadLetterQuery = new DeadLetterEnvelopeQueryParameters + { + Limit = 100 + }; + var deadLetterResults = await messageStore.DeadLetters.QueryDeadLetterEnvelopesAsync(deadLetterQuery); + + // Should have at least one dead letter message + deadLetterResults.DeadLetterEnvelopes.ShouldNotBeEmpty("Failed messages should be saved to SQL Server DLQ even with durable inbox"); + } +} + +public record WolverineStorageTestMessage; + +public static class WolverineStorageTestHandler +{ + public static void Handle(WolverineStorageTestMessage command) + { + throw new DivideByZeroException("Boom."); + } +} \ No newline at end of file From db4c69cecd7a8f0d4413def98cbda896e6a15e97 Mon Sep 17 00:00:00 2001 From: Joel Gullander Date: Tue, 15 Jul 2025 21:29:26 +0200 Subject: [PATCH 17/28] Update description --- .../Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs index 7808a67d2..4fb337dca 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Bugs/Bug_DLQ_NotSavedToDatabase.cs @@ -15,7 +15,7 @@ // Investigation: This test demonstrates the current behavior and investigates whether // this is the intended design or if there's a configuration issue. // -// See also: https://github.com/JasperFx/wolverine/issues/ +// See also: https://github.com/JasperFx/wolverine/issues/1568 using System; using System.Threading.Tasks; From 59f9044309d3254012ab7efa29d1e2b97373755b Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 10:40:49 -0500 Subject: [PATCH 18/28] Rabbit MQ queues will not appropriately use the correct DLQ mechanism for the various configuration options. --- .../Wolverine.RabbitMQ/Internal/RabbitMqQueue.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqQueue.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqQueue.cs index 7b0b810f4..a057727dc 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqQueue.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqQueue.cs @@ -368,8 +368,14 @@ public override async ValueTask BuildListenerAsync(IWolverineRuntime public override bool TryBuildDeadLetterSender(IWolverineRuntime runtime, out ISender? deadLetterSender) { - var dlq = _parent.Queues[DeadLetterQueue?.QueueName ?? _parent.DeadLetterQueue.QueueName]; - deadLetterSender = dlq.CreateSender(runtime); - return true; + if (DeadLetterQueue is { Mode: DeadLetterQueueMode.Native }) + { + var dlq = _parent.Queues[DeadLetterQueue?.QueueName ?? _parent.DeadLetterQueue.QueueName]; + deadLetterSender = dlq.CreateSender(runtime); + return true; + } + + deadLetterSender = default; + return false; } } \ No newline at end of file From d8e3d1ab3eabe2619695454163fb1e3090a77529 Mon Sep 17 00:00:00 2001 From: Anne Erdtsieck Date: Mon, 14 Jul 2025 21:06:15 +0200 Subject: [PATCH 19/28] #1569 Being able to use query params in URL in combination with ReadAggregate attribute --- .../Marten/using_read_aggregate_attribute.cs | 15 +++++++++++++++ .../Wolverine.Http/HttpChain.ApiDescription.cs | 5 +++++ src/Http/WolverineWebApi/Marten/Orders.cs | 3 +++ src/Wolverine/Attributes/ModifyChainAttribute.cs | 7 ++++++- .../Attributes/WolverineParameterAttribute.cs | 5 ----- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/Http/Wolverine.Http.Tests/Marten/using_read_aggregate_attribute.cs b/src/Http/Wolverine.Http.Tests/Marten/using_read_aggregate_attribute.cs index 408658182..b593d48bf 100644 --- a/src/Http/Wolverine.Http.Tests/Marten/using_read_aggregate_attribute.cs +++ b/src/Http/Wolverine.Http.Tests/Marten/using_read_aggregate_attribute.cs @@ -47,4 +47,19 @@ await Scenario(x => x.StatusCodeShouldBe(404); }); } + + [Fact] + public async Task happy_path_reading_aggregate_from_query() + { + var id = Guid.NewGuid(); + + // Creating a new order + await Scenario(x => + { + x.Post.Json(new StartOrderWithId(id, ["Socks", "Shoes", "Shirt"])).ToUrl("/orders/create4"); + }); + + var result = await Host.GetAsJson("/orders/latest/from-query?id=" + id); + result.Items.Keys.ShouldContain("Socks"); + } } \ No newline at end of file diff --git a/src/Http/Wolverine.Http/HttpChain.ApiDescription.cs b/src/Http/Wolverine.Http/HttpChain.ApiDescription.cs index dfe74712d..93740aff9 100644 --- a/src/Http/Wolverine.Http/HttpChain.ApiDescription.cs +++ b/src/Http/Wolverine.Http/HttpChain.ApiDescription.cs @@ -145,6 +145,11 @@ public override bool TryFindVariable(string valueName, ValueSource source, Type return true; } + if ((source == ValueSource.FromQueryString || source == ValueSource.Anything) && FindQuerystringVariable(valueType, valueName, out variable)) + { + return true; + } + if (HasRequestType) { var requestType = InputType(); diff --git a/src/Http/WolverineWebApi/Marten/Orders.cs b/src/Http/WolverineWebApi/Marten/Orders.cs index 4127f79d7..8580c7370 100644 --- a/src/Http/WolverineWebApi/Marten/Orders.cs +++ b/src/Http/WolverineWebApi/Marten/Orders.cs @@ -305,6 +305,9 @@ public static (UpdatedAggregate, OrderConfirmed) ConfirmDifferent2(ConfirmOrder [WolverineGet("/orders/V1.0/latest/{id}")] public static Order GetLatestV1(Guid id, [ReadAggregate] Order order) => order; + + [WolverineGet("/orders/latest/from-query")] + public static Order GetLatestFromQuery([FromQuery] Guid id, [ReadAggregate] Order order) => order; } #region sample_using_[FromQuery]_binding diff --git a/src/Wolverine/Attributes/ModifyChainAttribute.cs b/src/Wolverine/Attributes/ModifyChainAttribute.cs index 0a642f6e5..341d93b65 100644 --- a/src/Wolverine/Attributes/ModifyChainAttribute.cs +++ b/src/Wolverine/Attributes/ModifyChainAttribute.cs @@ -31,7 +31,12 @@ public enum ValueSource /// /// The value should be sourced by a route argument of an HTTP request /// - RouteValue + RouteValue, + + /// + /// The value should be sourced by a query string parameter of an HTTP request + /// + FromQueryString } #endregion \ No newline at end of file diff --git a/src/Wolverine/Attributes/WolverineParameterAttribute.cs b/src/Wolverine/Attributes/WolverineParameterAttribute.cs index 07a09d6c4..931b73873 100644 --- a/src/Wolverine/Attributes/WolverineParameterAttribute.cs +++ b/src/Wolverine/Attributes/WolverineParameterAttribute.cs @@ -76,11 +76,6 @@ protected bool tryFindIdentityVariable(IChain chain, ParameterInfo parameter, Ty { return true; } - - if (chain.TryFindVariable("id", ValueSource, idType, out variable)) - { - return true; - } variable = default; return false; From 5daf5858540e82a2316d8f0fe8ad61ff87f5afb5 Mon Sep 17 00:00:00 2001 From: Anne Erdtsieck Date: Mon, 14 Jul 2025 20:54:40 +0200 Subject: [PATCH 20/28] Update HttpChain.cs --- .../AggregateAttribute.cs | 10 +++++++ .../using_aggregate_handler_workflow.cs | 26 +++++++++++++++++++ src/Http/Wolverine.Http/HttpChain.cs | 17 ++++++++++++ src/Http/WolverineWebApi/Marten/Orders.cs | 14 ++++++++++ 4 files changed, 67 insertions(+) diff --git a/src/Http/Wolverine.Http.Marten/AggregateAttribute.cs b/src/Http/Wolverine.Http.Marten/AggregateAttribute.cs index f46cb6ded..7e1f7bf53 100644 --- a/src/Http/Wolverine.Http.Marten/AggregateAttribute.cs +++ b/src/Http/Wolverine.Http.Marten/AggregateAttribute.cs @@ -149,6 +149,16 @@ public override Variable Modify(HttpChain chain, ParameterInfo parameter, IServi return v3; } + if (chain.FindQuerystringVariable(idType, "id", out var v4)) + { + return v4; + } + + if (chain.FindQuerystringVariable(idType, $"{AggregateType.Name.ToCamelCase()}Id", out var v5)) + { + return v5; + } + return null; } diff --git a/src/Http/Wolverine.Http.Tests/Marten/using_aggregate_handler_workflow.cs b/src/Http/Wolverine.Http.Tests/Marten/using_aggregate_handler_workflow.cs index b8af81279..249dc9cc9 100644 --- a/src/Http/Wolverine.Http.Tests/Marten/using_aggregate_handler_workflow.cs +++ b/src/Http/Wolverine.Http.Tests/Marten/using_aggregate_handler_workflow.cs @@ -174,6 +174,32 @@ await Scenario(x => order.ShouldNotBeNull(); order.Shipped.HasValue.ShouldBeTrue(); } + + [Fact] + public async Task use_aggregate_in_endpoint_from_query_param_in_url() + { + var result1 = await Scenario(x => + { + x.Post.Json(new StartOrder(["Socks", "Shoes", "Shirt"])).ToUrl("/orders/create"); + }); + + var status1 = result1.ReadAsJson(); + status1.ShouldNotBeNull(); + + await Scenario(x => + { + x.Post.Url($"/orders/ship/from-query?id={status1.OrderId}"); + + x.StatusCodeShouldBe(204); + }); + + await using var session = Store.LightweightSession(); + + var order = await session.Events.AggregateStreamAsync(status1.OrderId); + + order.ShouldNotBeNull(); + order.Shipped.HasValue.ShouldBeTrue(); + } [Fact] public async Task use_stream_collision_policy() diff --git a/src/Http/Wolverine.Http/HttpChain.cs b/src/Http/Wolverine.Http/HttpChain.cs index 4587f5b6f..c239ce12a 100644 --- a/src/Http/Wolverine.Http/HttpChain.cs +++ b/src/Http/Wolverine.Http/HttpChain.cs @@ -418,6 +418,23 @@ private void applyMetadata() return variable; } + + public bool FindQuerystringVariable(Type variableType, string routeOrParameterName, [NotNullWhen(true)]out Variable? variable) + { + var matched = Method.Method.GetParameters() + .FirstOrDefault(x => x.ParameterType == variableType && x.Name != null && x.Name.EqualsIgnoreCase(routeOrParameterName)); + if (matched is not null) + { + variable = TryFindOrCreateQuerystringValue(matched); + if (variable is not null) + { + return true; + } + } + + variable = null; + return false; + } public HttpElementVariable? TryFindOrCreateQuerystringValue(ParameterInfo parameter) { diff --git a/src/Http/WolverineWebApi/Marten/Orders.cs b/src/Http/WolverineWebApi/Marten/Orders.cs index 8580c7370..bba689663 100644 --- a/src/Http/WolverineWebApi/Marten/Orders.cs +++ b/src/Http/WolverineWebApi/Marten/Orders.cs @@ -172,6 +172,20 @@ public static OrderShipped Ship4([Aggregate] Order order) return new OrderShipped(); } + #region sample_using_aggregate_attribute_query_parameter + + [WolverinePost("/orders/ship/from-query"), EmptyResponse] + // The OrderShipped return value is treated as an event being posted + // to a Marten even stream + // instead of as the HTTP response body because of the presence of + // the [EmptyResponse] attribute + public static OrderShipped ShipFromQuery([FromQuery] Guid id, [Aggregate] Order order) + { + return new OrderShipped(); + } + + #endregion + [Transactional] [WolverinePost("/orders/create")] public static OrderStatus StartOrder(StartOrder command, IDocumentSession session) From d372aedc2847db5c975d0545ddfeb773d974794e Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 11:00:48 -0500 Subject: [PATCH 21/28] Fixed regression bug with aggregate handler workflow and query string inputs --- src/Http/Wolverine.Http/CodeGen/QueryStringBindingFrame.cs | 2 ++ src/Http/Wolverine.Http/HttpChain.cs | 3 ++- src/Persistence/Wolverine.Marten/AggregateHandlerAttribute.cs | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Http/Wolverine.Http/CodeGen/QueryStringBindingFrame.cs b/src/Http/Wolverine.Http/CodeGen/QueryStringBindingFrame.cs index 5a6ae5b27..e64425127 100644 --- a/src/Http/Wolverine.Http/CodeGen/QueryStringBindingFrame.cs +++ b/src/Http/Wolverine.Http/CodeGen/QueryStringBindingFrame.cs @@ -28,6 +28,8 @@ public bool TryMatch(HttpChain chain, IServiceContainer container, ParameterInfo if (parameter.ParameterType.IsTypeOrNullableOf()) return false; if (parameter.ParameterType.IsTypeOrNullableOf()) return false; + chain.ComplexQueryStringType = parameter.ParameterType; + variable = new QueryStringBindingFrame(parameter.ParameterType, chain).Variable; return true; } diff --git a/src/Http/Wolverine.Http/HttpChain.cs b/src/Http/Wolverine.Http/HttpChain.cs index c239ce12a..f32388251 100644 --- a/src/Http/Wolverine.Http/HttpChain.cs +++ b/src/Http/Wolverine.Http/HttpChain.cs @@ -281,7 +281,7 @@ public override bool HasAttribute() public override Type? InputType() { - return HasRequestType ? RequestType : null; + return HasRequestType ? RequestType : ComplexQueryStringType; } public override Frame[] AddStopConditionIfNull(Variable variable) @@ -642,6 +642,7 @@ public HttpElementVariable GetOrCreateHeaderVariable(IFromHeaderMetadata metadat public bool HasRequestType => RequestType != null && RequestType != typeof(void); public bool IsFormData { get; internal set; } + public Type? ComplexQueryStringType { get; set; } internal Variable BuildJsonDeserializationVariable() { diff --git a/src/Persistence/Wolverine.Marten/AggregateHandlerAttribute.cs b/src/Persistence/Wolverine.Marten/AggregateHandlerAttribute.cs index 273b429d7..63a34662d 100644 --- a/src/Persistence/Wolverine.Marten/AggregateHandlerAttribute.cs +++ b/src/Persistence/Wolverine.Marten/AggregateHandlerAttribute.cs @@ -76,8 +76,10 @@ public override void Modify(IChain chain, GenerationRules rules, IServiceContain CommandType = chain.InputType(); if (CommandType == null) + { throw new InvalidOperationException( $"Cannot apply Marten aggregate handler workflow to chain {chain} because it has no input type"); + } AggregateType ??= DetermineAggregateType(chain); From 3f2521204565ffe1ec543ff91b00e83750a4aadd Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 12:08:30 -0500 Subject: [PATCH 22/28] Making WolverineRuntime.StartAsync() be idempotent to fix "double startup" problems. Closes GH-1566 --- src/Wolverine/Runtime/WolverineRuntime.HostService.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Wolverine/Runtime/WolverineRuntime.HostService.cs b/src/Wolverine/Runtime/WolverineRuntime.HostService.cs index e56f28199..88063f071 100644 --- a/src/Wolverine/Runtime/WolverineRuntime.HostService.cs +++ b/src/Wolverine/Runtime/WolverineRuntime.HostService.cs @@ -17,6 +17,9 @@ public partial class WolverineRuntime public async Task StartAsync(CancellationToken cancellationToken) { + // Make this idempotent because the AddResourceSetupOnStartup() can cause it to bootstrap twice + if (_hasStarted) return; + try { Logger.LogInformation("Starting Wolverine messaging for application assembly {Assembly}", @@ -96,8 +99,12 @@ public async Task StartAsync(CancellationToken cancellationToken) } } + private bool _hasMigratedStorage; + private async Task tryMigrateStorage() { + if (_hasMigratedStorage) return; + if (!Options.Durability.DurabilityAgentEnabled) return; if (Options.AutoBuildMessageStorageOnStartup != AutoCreate.None && Storage is not NullMessageStore) @@ -112,6 +119,8 @@ private async Task tryMigrateStorage() await ancillaryStore.Admin.MigrateAsync(); } } + + _hasMigratedStorage = true; } private bool _hasAppliedAsyncExtensions = false; From e71e04b48802d5589310aa658b5325c2bcfab2b9 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 13:28:15 -0500 Subject: [PATCH 23/28] Dealing w/ Eager setting in HTTP + the codegen command. Closes GH-1567 --- src/Http/CodeGenTarget/CodeGenTarget.csproj | 17 +++ src/Http/CodeGenTarget/CodeGenTarget.http | 6 + .../WolverineHandlers/GET_api_test.cs | 38 ++++++ src/Http/CodeGenTarget/Program.cs | 33 +++++ .../Properties/launchSettings.json | 23 ++++ .../appsettings.Development.json | 8 ++ src/Http/CodeGenTarget/appsettings.json | 9 ++ src/Http/Wolverine.Http/HttpChain.Codegen.cs | 5 +- .../HttpChain.EndpointBuilder.cs | 2 +- ...erineHttpEndpointRouteBuilderExtensions.cs | 5 + .../AfterMessage1Handler533023927.cs | 31 +++++ .../BeforeMessage1Handler784498762.cs | 31 +++++ .../CreateTodoRequestHandler482446425.cs | 55 ++++++++ .../CustomRequestHandler1116913013.cs | 34 +++++ .../WolverineHandlers/DELETE_api_trainer.cs | 57 +++++++++ .../DELETE_optional_result.cs | 51 ++++++++ .../DELETE_validate_user_compound.cs | 69 ++++++++++ .../WolverineHandlers/DataHandler620835457.cs | 32 +++++ .../DoSomethingWithTodoHandler1557821747.cs | 31 +++++ .../WolverineHandlers/GET_age_age.cs | 53 ++++++++ .../WolverineHandlers/GET_api_bigquery.cs | 119 ++++++++++++++++++ .../WolverineHandlers/GET_api_fromquery1.cs | 42 +++++++ .../WolverineHandlers/GET_api_fromquery2.cs | 49 ++++++++ .../WolverineHandlers/GET_api_fromquery3.cs | 49 ++++++++ .../WolverineHandlers/GET_api_fromquery4.cs | 58 +++++++++ .../GET_api_myapp_registration_price.cs | 47 +++++++ .../WolverineHandlers/GET_api_todo_id.cs | 65 ++++++++++ .../WolverineHandlers/GET_correlation.cs | 47 +++++++ .../WolverineHandlers/GET_data_id.cs | 72 +++++++++++ .../WolverineHandlers/GET_discovered.cs | 38 ++++++ ...ent_required_document_attribute_only_id.cs | 87 +++++++++++++ ...ocument_required_separate_attributes_id.cs | 87 +++++++++++++ .../WolverineHandlers/GET_enum_direction.cs | 53 ++++++++ .../WolverineHandlers/GET_headers_accepts.cs | 42 +++++++ .../WolverineHandlers/GET_headers_int.cs | 49 ++++++++ .../WolverineHandlers/GET_headers_simple.cs | 42 +++++++ .../Generated/WolverineHandlers/GET_hello.cs | 39 ++++++ .../WolverineHandlers/GET_http_context.cs | 41 ++++++ .../WolverineHandlers/GET_http_identifier.cs | 39 ++++++ .../WolverineHandlers/GET_http_principal.cs | 41 ++++++ .../WolverineHandlers/GET_http_request.cs | 41 ++++++ .../WolverineHandlers/GET_http_response.cs | 41 ++++++ .../GET_invoices_approved.cs | 47 +++++++ .../GET_invoices_compiled_count.cs | 48 +++++++ .../GET_invoices_compiled_id.cs | 61 +++++++++ .../WolverineHandlers/GET_invoices_id.cs | 78 ++++++++++++ .../GET_invoices_soft_delete_id.cs | 87 +++++++++++++ .../WolverineHandlers/GET_message_message.cs | 49 ++++++++ .../GET_middleware_header.cs | 46 +++++++ .../GET_middleware_intrinsic.cs | 44 +++++++ .../GET_middleware_simple.cs | 44 +++++++ .../WolverineHandlers/GET_name_name.cs | 46 +++++++ .../GET_orders_V1_0_latest_id.cs | 70 +++++++++++ .../GET_orders_latest_from_query.cs | 64 ++++++++++ .../WolverineHandlers/GET_orders_latest_id.cs | 70 +++++++++++ .../GET_querystring_collection_enum.cs | 48 +++++++ .../GET_querystring_collection_guid.cs | 48 +++++++ .../GET_querystring_collection_int.cs | 48 +++++++ .../GET_querystring_collection_string.cs | 40 ++++++ .../GET_querystring_dateonly.cs | 46 +++++++ .../GET_querystring_dateonly_nullable.cs | 46 +++++++ .../GET_querystring_datetime.cs | 46 +++++++ .../GET_querystring_datetime2.cs | 46 +++++++ .../GET_querystring_datetime_nullable.cs | 46 +++++++ .../GET_querystring_decimal.cs | 50 ++++++++ .../WolverineHandlers/GET_querystring_enum.cs | 46 +++++++ .../GET_querystring_explicit.cs | 39 ++++++ .../WolverineHandlers/GET_querystring_int.cs | 50 ++++++++ .../GET_querystring_int_nullable.cs | 47 +++++++ .../GET_querystring_intarray.cs | 49 ++++++++ .../GET_querystring_string.cs | 40 ++++++ .../GET_querystring_stringarray.cs | 39 ++++++ .../Generated/WolverineHandlers/GET_result.cs | 38 ++++++ .../WolverineHandlers/GET_result_async.cs | 38 ++++++ .../WolverineHandlers/GET_results_static.cs | 40 ++++++ .../WolverineHandlers/GET_thing_blue.cs | 39 ++++++ .../WolverineHandlers/GET_thing_red.cs | 41 ++++++ .../WolverineHandlers/GET_wildcard_name.cs | 46 +++++++ .../WolverineHandlers/GET_write_to_id.cs | 62 +++++++++ .../HttpMessage1Handler862252953.cs | 31 +++++ .../HttpMessage2Handler1265537480.cs | 31 +++++ .../HttpMessage3Handler300546461.cs | 31 +++++ .../HttpMessage4Handler102738066.cs | 31 +++++ .../HttpMessage5Handler1463345875.cs | 31 +++++ .../ItemCreatedHandler179438836.cs | 32 +++++ ...AlwaysGoesToDeadLetterHandler1388008025.cs | 31 +++++ .../NumberMessageHandler722393759.cs | 47 +++++++ .../POST_api_asparameters1.cs | 114 +++++++++++++++++ .../WolverineHandlers/POST_api_fromform1.cs | 42 +++++++ .../WolverineHandlers/POST_api_fromform2.cs | 49 ++++++++ .../WolverineHandlers/POST_api_fromform3.cs | 49 ++++++++ .../WolverineHandlers/POST_api_fromform4.cs | 58 +++++++++ .../POST_api_fromformbigquery.cs | 119 ++++++++++++++++++ .../POST_api_todo2_id_something.cs | 69 ++++++++++ .../POST_api_todo_complete.cs | 74 +++++++++++ .../WolverineHandlers/POST_api_todo_create.cs | 66 ++++++++++ .../POST_api_todo_create2.cs | 66 ++++++++++ .../POST_api_todo_examinefirst.cs | 70 +++++++++++ .../POST_api_todo_maybecomplete.cs | 67 ++++++++++ .../POST_api_todo_maybeinsert.cs | 64 ++++++++++ ...i_todo_maybetaskcompletewithbeforeusage.cs | 77 ++++++++++++ .../POST_api_todo_nullaction.cs | 64 ++++++++++ .../POST_api_todo_nullinsert.cs | 66 ++++++++++ .../WolverineHandlers/POST_api_todo_update.cs | 76 +++++++++++ .../POST_api_todo_update2.cs | 76 +++++++++++ .../POST_api_todo_update3.cs | 76 +++++++++++ .../WolverineHandlers/POST_asp2_id_number.cs | 69 ++++++++++ .../POST_asparameterrecord_Id.cs | 72 +++++++++++ .../WolverineHandlers/POST_authenticated.cs | 52 ++++++++ .../WolverineHandlers/POST_convert_book.cs | 51 ++++++++ .../POST_discovered_fsharp_unit.cs | 39 ++++++ .../WolverineHandlers/POST_ef_create.cs | 61 +++++++++ .../WolverineHandlers/POST_ef_publish.cs | 66 ++++++++++ .../WolverineHandlers/POST_form_dateonly.cs | 46 +++++++ .../POST_form_dateonly_nullable.cs | 46 +++++++ .../WolverineHandlers/POST_form_datetime.cs | 46 +++++++ .../WolverineHandlers/POST_form_datetime2.cs | 46 +++++++ .../POST_form_datetime_nullable.cs | 46 +++++++ .../WolverineHandlers/POST_form_decimal.cs | 50 ++++++++ .../WolverineHandlers/POST_form_enum.cs | 46 +++++++ .../WolverineHandlers/POST_form_explicit.cs | 39 ++++++ .../WolverineHandlers/POST_form_int.cs | 50 ++++++++ .../POST_form_int_nullable.cs | 47 +++++++ .../WolverineHandlers/POST_form_string.cs | 40 ++++++ .../WolverineHandlers/POST_fromservices.cs | 42 +++++++ .../POST_invoices_invoiceId_pay.cs | 86 +++++++++++++ .../POST_invoices_number_approve.cs | 86 +++++++++++++ .../Generated/WolverineHandlers/POST_issue.cs | 70 +++++++++++ .../POST_middleware_messages_name.cs | 69 ++++++++++ .../WolverineHandlers/POST_notbody.cs | 42 +++++++ .../WolverineHandlers/POST_orders_create.cs | 59 +++++++++ .../WolverineHandlers/POST_orders_create2.cs | 80 ++++++++++++ .../WolverineHandlers/POST_orders_create3.cs | 82 ++++++++++++ .../WolverineHandlers/POST_orders_create4.cs | 80 ++++++++++++ .../POST_orders_id_confirm.cs | 67 ++++++++++ .../POST_orders_id_confirm2.cs | 67 ++++++++++ .../POST_orders_id_confirm3.cs | 60 +++++++++ .../POST_orders_itemready.cs | 73 +++++++++++ .../POST_orders_orderId_ship2.cs | 74 +++++++++++ .../POST_orders_orderId_ship3.cs | 71 +++++++++++ .../POST_orders_orderId_ship4.cs | 71 +++++++++++ .../WolverineHandlers/POST_orders_ship.cs | 67 ++++++++++ .../POST_orders_ship_from_query.cs | 65 ++++++++++ .../WolverineHandlers/POST_problems.cs | 51 ++++++++ .../WolverineHandlers/POST_problems2.cs | 51 ++++++++ .../POST_publish_marten_message.cs | 61 +++++++++ .../POST_publish_message1.cs | 51 ++++++++ .../WolverineHandlers/POST_question.cs | 43 +++++++ .../WolverineHandlers/POST_reservation.cs | 66 ++++++++++ .../POST_send_always_dead_letter.cs | 51 ++++++++ .../WolverineHandlers/POST_send_message5.cs | 51 ++++++++ .../WolverineHandlers/POST_some_id.cs | 82 ++++++++++++ .../Generated/WolverineHandlers/POST_spawn.cs | 53 ++++++++ .../WolverineHandlers/POST_spawn2.cs | 55 ++++++++ .../WolverineHandlers/POST_status.cs | 44 +++++++ .../WolverineHandlers/POST_things.cs | 82 ++++++++++++ .../WolverineHandlers/POST_users_sign_up.cs | 41 ++++++ .../POST_validate2_customer.cs | 59 +++++++++ .../POST_validate_customer.cs | 59 +++++++++ .../WolverineHandlers/POST_validate_user.cs | 56 +++++++++ .../WolverineHandlers/PUT_todos2_id.cs | 82 ++++++++++++ .../WolverineHandlers/PUT_todos3_id.cs | 98 +++++++++++++++ .../WolverineHandlers/PUT_todos_id.cs | 89 +++++++++++++ .../TelegramUpdatedHandler96651444.cs | 31 +++++ .../Event3Handler1940643383.cs | 50 ++++++++ .../IncrementABHandler294362820.cs | 54 ++++++++ .../IncrementAHandler17491962.cs | 48 +++++++ .../IncrementBCHandler1271721124.cs | 55 ++++++++ .../IncrementBHandler17491959.cs | 51 ++++++++ .../IncrementCDHandler868436596.cs | 49 ++++++++ .../IncrementCHandler17491960.cs | 47 +++++++ .../IncrementDHandler17491957.cs | 47 +++++++ .../IncrementManyAsyncHandler1215209648.cs | 55 ++++++++ .../IncrementManyHandler1449869648.cs | 55 ++++++++ .../LetterMessage1Handler689109168.cs | 31 +++++ .../LetterMessage2Handler689109169.cs | 31 +++++ .../Outgoing1Handler430475575.cs | 31 +++++ .../RaiseAAAHandler2123707049.cs | 50 ++++++++ .../RaiseAABCCHandler321015832.cs | 58 +++++++++ .../RaiseABCHandler1767975722.cs | 58 +++++++++ .../RaiseBBCCCHandler1466785177.cs | 62 +++++++++ .../RaiseHandler488373842.cs | 60 +++++++++ .../RaiseIfValidatedHandler791852127.cs | 57 +++++++++ .../RaiseLotsAsyncHandler840624058.cs | 48 +++++++ .../RaiseOnlyDHandler1355962904.cs | 47 +++++++ .../ResponseHandler2029358463.cs | 31 +++++ src/Wolverine/Wolverine.csproj | 2 +- wolverine.sln | 15 +++ 188 files changed, 9785 insertions(+), 3 deletions(-) create mode 100644 src/Http/CodeGenTarget/CodeGenTarget.csproj create mode 100644 src/Http/CodeGenTarget/CodeGenTarget.http create mode 100644 src/Http/CodeGenTarget/Internal/Generated/WolverineHandlers/GET_api_test.cs create mode 100644 src/Http/CodeGenTarget/Program.cs create mode 100644 src/Http/CodeGenTarget/Properties/launchSettings.json create mode 100644 src/Http/CodeGenTarget/appsettings.Development.json create mode 100644 src/Http/CodeGenTarget/appsettings.json create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/AfterMessage1Handler533023927.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/BeforeMessage1Handler784498762.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CreateTodoRequestHandler482446425.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CustomRequestHandler1116913013.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_api_trainer.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_optional_result.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_validate_user_compound.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DataHandler620835457.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DoSomethingWithTodoHandler1557821747.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_age_age.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_bigquery.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery1.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery3.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery4.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_myapp_registration_price.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_todo_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_correlation.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_data_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_discovered.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_document_attribute_only_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_separate_attributes_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_enum_direction.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_accepts.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_int.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_simple.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_hello.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_context.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_identifier.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_principal.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_request.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_response.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_approved.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_count.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_soft_delete_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_message_message.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_header.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_intrinsic.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_simple.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_name_name.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_V1_0_latest_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_latest_from_query.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_latest_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_enum.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_guid.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_int.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_string.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_dateonly.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_dateonly_nullable.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime_nullable.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_decimal.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_enum.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_explicit.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int_nullable.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_intarray.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_string.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_stringarray.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result_async.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_results_static.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_thing_blue.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_thing_red.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_wildcard_name.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_write_to_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage1Handler862252953.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage2Handler1265537480.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage3Handler300546461.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage4Handler102738066.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage5Handler1463345875.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/ItemCreatedHandler179438836.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/MessageThatAlwaysGoesToDeadLetterHandler1388008025.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/NumberMessageHandler722393759.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_asparameters1.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform1.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform3.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform4.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromformbigquery.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo2_id_something.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_complete.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_create.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_create2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_examinefirst.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybecomplete.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybeinsert.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybetaskcompletewithbeforeusage.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_nullaction.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_nullinsert.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update3.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_asp2_id_number.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_asparameterrecord_Id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_authenticated.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_convert_book.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_discovered_fsharp_unit.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_create.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_publish.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_dateonly.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_dateonly_nullable.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime_nullable.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_decimal.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_enum.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_explicit.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_int.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_int_nullable.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_string.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_fromservices.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_invoiceId_pay.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_number_approve.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_issue.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_middleware_messages_name.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_notbody.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create3.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create4.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm3.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_itemready.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship3.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship4.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship_from_query.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_marten_message.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_message1.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_question.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_reservation.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_always_dead_letter.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_message5.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_some_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn2.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_status.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_things.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_users_sign_up.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate2_customer.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_customer.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_user.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos2_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos3_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos_id.cs create mode 100644 src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/TelegramUpdatedHandler96651444.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/Event3Handler1940643383.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementABHandler294362820.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementAHandler17491962.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementBCHandler1271721124.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementBHandler17491959.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementCDHandler868436596.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementCHandler17491960.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementDHandler17491957.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementManyAsyncHandler1215209648.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementManyHandler1449869648.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/LetterMessage1Handler689109168.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/LetterMessage2Handler689109169.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/Outgoing1Handler430475575.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseAAAHandler2123707049.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseAABCCHandler321015832.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseABCHandler1767975722.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseBBCCCHandler1466785177.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseHandler488373842.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseIfValidatedHandler791852127.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseLotsAsyncHandler840624058.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseOnlyDHandler1355962904.cs create mode 100644 src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/ResponseHandler2029358463.cs diff --git a/src/Http/CodeGenTarget/CodeGenTarget.csproj b/src/Http/CodeGenTarget/CodeGenTarget.csproj new file mode 100644 index 000000000..1b1722030 --- /dev/null +++ b/src/Http/CodeGenTarget/CodeGenTarget.csproj @@ -0,0 +1,17 @@ + + + + net9.0 + enable + enable + + + + + + + + + + + diff --git a/src/Http/CodeGenTarget/CodeGenTarget.http b/src/Http/CodeGenTarget/CodeGenTarget.http new file mode 100644 index 000000000..c4814cba0 --- /dev/null +++ b/src/Http/CodeGenTarget/CodeGenTarget.http @@ -0,0 +1,6 @@ +@CodeGenTarget_HostAddress = http://localhost:5224 + +GET {{CodeGenTarget_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/src/Http/CodeGenTarget/Internal/Generated/WolverineHandlers/GET_api_test.cs b/src/Http/CodeGenTarget/Internal/Generated/WolverineHandlers/GET_api_test.cs new file mode 100644 index 000000000..582081ced --- /dev/null +++ b/src/Http/CodeGenTarget/Internal/Generated/WolverineHandlers/GET_api_test.cs @@ -0,0 +1,38 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_api_test + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_api_test : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_api_test(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + + // The actual HTTP request handler execution + var result_of_Handle = ExampleHandler.Handle(); + + await WriteString(httpContext, result_of_Handle); + } + + } + + // END: GET_api_test + + +} + diff --git a/src/Http/CodeGenTarget/Program.cs b/src/Http/CodeGenTarget/Program.cs new file mode 100644 index 000000000..66c92e393 --- /dev/null +++ b/src/Http/CodeGenTarget/Program.cs @@ -0,0 +1,33 @@ +using JasperFx; +using Wolverine; +using Wolverine.Http; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +builder.Host.UseWolverine(); +builder.Services.AddWolverineHttp(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.MapWolverineEndpoints(x => x.WarmUpRoutes = RouteWarmup.Eager); + +return await app.RunJasperFxCommands(args); + +public static class ExampleHandler +{ + [WolverineGet("/api/test")] + public static string Handle() + { + return "tested"; + } +} \ No newline at end of file diff --git a/src/Http/CodeGenTarget/Properties/launchSettings.json b/src/Http/CodeGenTarget/Properties/launchSettings.json new file mode 100644 index 000000000..01fd741b6 --- /dev/null +++ b/src/Http/CodeGenTarget/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5224", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7246;http://localhost:5224", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/Http/CodeGenTarget/appsettings.Development.json b/src/Http/CodeGenTarget/appsettings.Development.json new file mode 100644 index 000000000..0c208ae91 --- /dev/null +++ b/src/Http/CodeGenTarget/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/Http/CodeGenTarget/appsettings.json b/src/Http/CodeGenTarget/appsettings.json new file mode 100644 index 000000000..10f68b8c8 --- /dev/null +++ b/src/Http/CodeGenTarget/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/Http/Wolverine.Http/HttpChain.Codegen.cs b/src/Http/Wolverine.Http/HttpChain.Codegen.cs index 051a52f72..ac61ca647 100644 --- a/src/Http/Wolverine.Http/HttpChain.Codegen.cs +++ b/src/Http/Wolverine.Http/HttpChain.Codegen.cs @@ -32,7 +32,10 @@ public partial class HttpChain void ICodeFile.AssembleTypes(GeneratedAssembly assembly) { - if (_generatedType != null) return; + if (_generatedType != null) + { + return; + } lock (_locker) { diff --git a/src/Http/Wolverine.Http/HttpChain.EndpointBuilder.cs b/src/Http/Wolverine.Http/HttpChain.EndpointBuilder.cs index 13b88521d..50de08368 100644 --- a/src/Http/Wolverine.Http/HttpChain.EndpointBuilder.cs +++ b/src/Http/Wolverine.Http/HttpChain.EndpointBuilder.cs @@ -61,7 +61,7 @@ public RouteEndpoint BuildEndpoint(RouteWarmup warmup) } else { - if (warmup == RouteWarmup.Eager) + if (warmup == RouteWarmup.Eager && !DynamicCodeBuilder.WithinCodegenCommand) { this.InitializeSynchronously(_parent.Rules, _parent, _parent.Container.Services); var handler = (HttpHandler)_parent.Container.QuickBuild(_handlerType); diff --git a/src/Http/Wolverine.Http/WolverineHttpEndpointRouteBuilderExtensions.cs b/src/Http/Wolverine.Http/WolverineHttpEndpointRouteBuilderExtensions.cs index f23c5af44..ecde8a9c1 100644 --- a/src/Http/Wolverine.Http/WolverineHttpEndpointRouteBuilderExtensions.cs +++ b/src/Http/Wolverine.Http/WolverineHttpEndpointRouteBuilderExtensions.cs @@ -191,6 +191,11 @@ public static void MapWolverineEndpoints(this IEndpointRouteBuilder endpoints, options.Endpoints = new HttpGraph(runtime.Options, serviceProvider.GetRequiredService()); configure?.Invoke(options); + + if (Environment.CommandLine.Contains("codegen", StringComparison.OrdinalIgnoreCase)) + { + options.WarmUpRoutes = RouteWarmup.Lazy; + } options.JsonSerializerOptions = new Lazy(() => serviceProvider.GetService>()?.Value?.SerializerOptions ?? new JsonSerializerOptions()); diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/AfterMessage1Handler533023927.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/AfterMessage1Handler533023927.cs new file mode 100644 index 000000000..b691d180f --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/AfterMessage1Handler533023927.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: AfterMessage1Handler533023927 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class AfterMessage1Handler533023927 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var afterMessage1 = (WolverineWebApi.AfterMessage1)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MiddlewareMessageHandler"); + + // The actual message execution + WolverineWebApi.MiddlewareMessageHandler.Handle(afterMessage1); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: AfterMessage1Handler533023927 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/BeforeMessage1Handler784498762.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/BeforeMessage1Handler784498762.cs new file mode 100644 index 000000000..9c33bdd6d --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/BeforeMessage1Handler784498762.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: BeforeMessage1Handler784498762 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class BeforeMessage1Handler784498762 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var beforeMessage1 = (WolverineWebApi.BeforeMessage1)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MiddlewareMessageHandler"); + + // The actual message execution + WolverineWebApi.MiddlewareMessageHandler.Handle(beforeMessage1); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: BeforeMessage1Handler784498762 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CreateTodoRequestHandler482446425.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CreateTodoRequestHandler482446425.cs new file mode 100644 index 000000000..48f1de07f --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CreateTodoRequestHandler482446425.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: CreateTodoRequestHandler482446425 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class CreateTodoRequestHandler482446425 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public CreateTodoRequestHandler482446425(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + // The actual message body + var createTodoRequest = (WolverineWebApi.Todos.CreateTodoRequest)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.Todos.TodoHandler"); + + // The actual message execution + var outgoing1 = WolverineWebApi.Todos.TodoHandler.Handle(createTodoRequest); + + if (outgoing1 != null) + { + + // Register the document operation with the current session + documentSession.Insert(outgoing1.Entity); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await context.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: CreateTodoRequestHandler482446425 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CustomRequestHandler1116913013.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CustomRequestHandler1116913013.cs new file mode 100644 index 000000000..cf6e1bd3f --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CustomRequestHandler1116913013.cs @@ -0,0 +1,34 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: CustomRequestHandler1116913013 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class CustomRequestHandler1116913013 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var customRequest = (WolverineWebApi.CustomRequest)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MessageHandler"); + + // The actual message execution + var outgoing1 = WolverineWebApi.MessageHandler.Handle(customRequest); + + + // Outgoing, cascaded message + await context.EnqueueCascadingAsync(outgoing1).ConfigureAwait(false); + + } + + } + + // END: CustomRequestHandler1116913013 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_api_trainer.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_api_trainer.cs new file mode 100644 index 000000000..5da3ea2a1 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_api_trainer.cs @@ -0,0 +1,57 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: DELETE_api_trainer + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class DELETE_api_trainer : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public DELETE_api_trainer(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var userId = WolverineWebApi.UserIdMiddleware.LoadAsync(httpContext); + var trainerDelete = new WolverineWebApi.TrainerDelete(); + + // The actual HTTP request handler execution + var result = await trainerDelete.Delete(userId, documentSession, httpContext.RequestAborted).ConfigureAwait(false); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + await result.ExecuteAsync(httpContext).ConfigureAwait(false); + } + + } + + // END: DELETE_api_trainer + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_optional_result.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_optional_result.cs new file mode 100644 index 000000000..c27f7de68 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_optional_result.cs @@ -0,0 +1,51 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: DELETE_optional_result + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class DELETE_optional_result : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public DELETE_optional_result(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (cmd, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var user = WolverineWebApi.Validation.ValidatedCompoundEndpoint2.Load(cmd); + var result1 = WolverineWebApi.Validation.ValidatedCompoundEndpoint2.Validate(user); + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var result_of_Handle = WolverineWebApi.Validation.ValidatedCompoundEndpoint2.Handle(cmd, user); + + await WriteString(httpContext, result_of_Handle); + } + + } + + // END: DELETE_optional_result + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_validate_user_compound.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_validate_user_compound.cs new file mode 100644 index 000000000..c84587c49 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_validate_user_compound.cs @@ -0,0 +1,69 @@ +// +#pragma warning disable +using FluentValidation; +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Http.FluentValidation; + +namespace Internal.Generated.WolverineHandlers +{ + // START: DELETE_validate_user_compound + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class DELETE_validate_user_compound : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Http.FluentValidation.IProblemDetailSource _problemDetailSource; + private readonly FluentValidation.IValidator _validator; + + public DELETE_validate_user_compound(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Http.FluentValidation.IProblemDetailSource problemDetailSource, FluentValidation.IValidator validator) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _problemDetailSource = problemDetailSource; + _validator = validator; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (cmd, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Execute FluentValidation validators + var result1 = await Wolverine.Http.FluentValidation.Internals.FluentValidationHttpExecutor.ExecuteOne(_validator, _problemDetailSource, cmd).ConfigureAwait(false); + + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + var user = WolverineWebApi.Validation.ValidatedCompoundEndpoint.Load(cmd); + var result2 = WolverineWebApi.Validation.ValidatedCompoundEndpoint.Validate(user); + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result2 != null && !(result2 is Wolverine.Http.WolverineContinue)) + { + await result2.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var result_of_Handle = WolverineWebApi.Validation.ValidatedCompoundEndpoint.Handle(cmd, user); + + await WriteString(httpContext, result_of_Handle); + } + + } + + // END: DELETE_validate_user_compound + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DataHandler620835457.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DataHandler620835457.cs new file mode 100644 index 000000000..a1813e74f --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DataHandler620835457.cs @@ -0,0 +1,32 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: DataHandler620835457 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class DataHandler620835457 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var data = (WolverineWebApi.Data)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.DataHandler"); + var dataHandler = new WolverineWebApi.DataHandler(); + + // The actual message execution + dataHandler.Handle(data); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: DataHandler620835457 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DoSomethingWithTodoHandler1557821747.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DoSomethingWithTodoHandler1557821747.cs new file mode 100644 index 000000000..a755c0a1f --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DoSomethingWithTodoHandler1557821747.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: DoSomethingWithTodoHandler1557821747 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class DoSomethingWithTodoHandler1557821747 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var doSomethingWithTodo = (WolverineWebApi.Marten.DoSomethingWithTodo)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.Marten.DoSomethingWithTodoHandler"); + + // The actual message execution + WolverineWebApi.Marten.DoSomethingWithTodoHandler.Handle(doSomethingWithTodo); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: DoSomethingWithTodoHandler1557821747 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_age_age.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_age_age.cs new file mode 100644 index 000000000..cf545b72b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_age_age.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_age_age + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_age_age : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_age_age(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string age_rawValue = (string?)httpContext.GetRouteValue("age"); + int age = default; + + if (age_rawValue != null && int.TryParse(age_rawValue, System.Globalization.CultureInfo.InvariantCulture, out age)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_IntRouteArgument = WolverineWebApi.TestEndpoints.IntRouteArgument(age); + + await WriteString(httpContext, result_of_IntRouteArgument); + } + + } + + // END: GET_age_age + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_bigquery.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_bigquery.cs new file mode 100644 index 000000000..d59671c91 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_bigquery.cs @@ -0,0 +1,119 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_api_bigquery + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_api_bigquery : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_api_bigquery(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Binding QueryString values to the argument marked with [FromQuery] + var bigQuery = new WolverineWebApi.BigQuery(); + bigQuery.Name = httpContext.Request.Query["Name"]; + string Number_rawValue = httpContext.Request.Query["Number"]; + + if (Number_rawValue != null && int.TryParse(Number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var Number)) + { + bigQuery.Number = Number; + } + + string Direction_rawValue = httpContext.Request.Query["Direction"]; + + if (WolverineWebApi.Direction.TryParse(Direction_rawValue, true, out var Direction)) + { + bigQuery.Direction = Direction; + } + + bigQuery.Values = httpContext.Request.Query["Values"].ToArray(); + var Numbers_List = new System.Collections.Generic.List(); + foreach (var NumbersValue in httpContext.Request.Query["Numbers"]) + { + if (int.TryParse(NumbersValue, System.Globalization.CultureInfo.InvariantCulture, out var NumbersValueParsed)) + { + Numbers_List.Add(NumbersValueParsed); + } + + } + + if (Numbers_List.Any()) bigQuery.Numbers = Numbers_List.ToArray(); + string Flag_rawValue = httpContext.Request.Query["Flag"]; + + if (bool.TryParse(Flag_rawValue, out var Flag)) + { + bigQuery.Flag = Flag; + } + + string NullableNumber_rawValue = httpContext.Request.Query["NullableNumber"]; + + if (NullableNumber_rawValue != null && int.TryParse(NullableNumber_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var NullableNumber_parsed)) + { + bigQuery.NullableNumber = NullableNumber_parsed; + } + + string NullableDirection_rawValue = httpContext.Request.Query["NullableDirection"]; + + if (WolverineWebApi.Direction.TryParse(NullableDirection_rawValue, true, out var NullableDirection_parsed)) + { + bigQuery.NullableDirection = NullableDirection_parsed; + } + + string NullableFlag_rawValue = httpContext.Request.Query["NullableFlag"]; + + if (bool.TryParse(NullableFlag_rawValue, out var NullableFlag_parsed)) + { + bigQuery.NullableFlag = NullableFlag_parsed; + } + + bigQuery.ValueWithAlias = httpContext.Request.Query["aliased"]; + bigQuery.ListValues = new System.Collections.Generic.List(); + bigQuery.ListValues.AddRange(httpContext.Request.Query["ListValues"]); + bigQuery.EnumListValues = new System.Collections.Generic.List(); + foreach (var EnumListValuesValue in httpContext.Request.Query["EnumListValues"]) + { + if (WolverineWebApi.Direction.TryParse(EnumListValuesValue, true, out var EnumListValuesValueParsed)) + { + bigQuery.EnumListValues.Add(EnumListValuesValueParsed); + } + + } + + bigQuery.IntList = new System.Collections.Generic.List(); + foreach (var IntListValue in httpContext.Request.Query["IntList"]) + { + if (int.TryParse(IntListValue, System.Globalization.CultureInfo.InvariantCulture, out var IntListValueParsed)) + { + bigQuery.IntList.Add(IntListValueParsed); + } + + } + + + // The actual HTTP request handler execution + var bigQuery_response = WolverineWebApi.FromQueryEndpoints.Get(bigQuery); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, bigQuery_response); + } + + } + + // END: GET_api_bigquery + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery1.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery1.cs new file mode 100644 index 000000000..f6611d2e7 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery1.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_api_fromquery1 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_api_fromquery1 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_api_fromquery1(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var Name = httpContext.Request.Query["Name"]; + // Binding QueryString values to the argument marked with [FromQuery] + var query1 = new WolverineWebApi.Query1(Name); + + // The actual HTTP request handler execution + var query1_response = WolverineWebApi.FromQueryEndpoints.Get(query1); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, query1_response); + } + + } + + // END: GET_api_fromquery1 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery2.cs new file mode 100644 index 000000000..e4dea7ee7 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery2.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_api_fromquery2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_api_fromquery2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_api_fromquery2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string Number_rawValue = httpContext.Request.Query["Number"]; + int Number = default; + + if (Number_rawValue != null && int.TryParse(Number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out Number)) + { + + } + + // Binding QueryString values to the argument marked with [FromQuery] + var query2 = new WolverineWebApi.Query2(Number); + + // The actual HTTP request handler execution + var query2_response = WolverineWebApi.FromQueryEndpoints.Get(query2); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, query2_response); + } + + } + + // END: GET_api_fromquery2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery3.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery3.cs new file mode 100644 index 000000000..7f6563530 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery3.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_api_fromquery3 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_api_fromquery3 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_api_fromquery3(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string Id_rawValue = httpContext.Request.Query["Id"]; + System.Guid Id = default; + + if (Id_rawValue != null && System.Guid.TryParse(Id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out Id)) + { + + } + + // Binding QueryString values to the argument marked with [FromQuery] + var query3 = new WolverineWebApi.Query3(Id); + + // The actual HTTP request handler execution + var query3_response = WolverineWebApi.FromQueryEndpoints.Get(query3); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, query3_response); + } + + } + + // END: GET_api_fromquery3 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery4.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery4.cs new file mode 100644 index 000000000..2ea0fd74b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_fromquery4.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_api_fromquery4 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_api_fromquery4 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_api_fromquery4(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string Direction_rawValue = httpContext.Request.Query["Direction"]; + WolverineWebApi.Direction Direction = default; + + if (WolverineWebApi.Direction.TryParse(Direction_rawValue, true, out Direction)) + { + + } + + string Number_rawValue = httpContext.Request.Query["Number"]; + int Number = default; + + if (Number_rawValue != null && int.TryParse(Number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out Number)) + { + + } + + var Name = httpContext.Request.Query["Name"]; + // Binding QueryString values to the argument marked with [FromQuery] + var query4 = new WolverineWebApi.Query4(Name, Number, Direction); + + // The actual HTTP request handler execution + var query4_response = WolverineWebApi.FromQueryEndpoints.Get(query4); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, query4_response); + } + + } + + // END: GET_api_fromquery4 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_myapp_registration_price.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_myapp_registration_price.cs new file mode 100644 index 000000000..5f73cb16f --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_myapp_registration_price.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_api_myapp_registration_price + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_api_myapp_registration_price : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_api_myapp_registration_price(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string numberOfMembers_rawValue = httpContext.Request.Query["numberOfMembers"]; + int numberOfMembers = default; + + if (numberOfMembers_rawValue != null && int.TryParse(numberOfMembers_rawValue, System.Globalization.CultureInfo.InvariantCulture, out numberOfMembers)) + { + + } + + + // The actual HTTP request handler execution + var decimalValue_response = WolverineWebApi.Bugs.MyAppLandingEndpoint.GetRegistrationPrice(numberOfMembers); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, decimalValue_response); + } + + } + + // END: GET_api_myapp_registration_price + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_todo_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_todo_id.cs new file mode 100644 index 000000000..812166a22 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_todo_id.cs @@ -0,0 +1,65 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_api_todo_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_api_todo_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_api_todo_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var id = (string?)httpContext.GetRouteValue("id"); + if(id == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (todo2 == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var todo2_response = WolverineWebApi.Todos.TodoHandler.Get(todo2); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, todo2_response); + } + + } + + // END: GET_api_todo_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_correlation.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_correlation.cs new file mode 100644 index 000000000..d43939d86 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_correlation.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_correlation + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_correlation : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + + public GET_correlation(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + + // The actual HTTP request handler execution + var result_of_GetCorrelation = WolverineWebApi.TracingEndpoint.GetCorrelation(messageContext); + + await WriteString(httpContext, result_of_GetCorrelation); + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: GET_correlation + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_data_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_data_id.cs new file mode 100644 index 000000000..334d4ae7e --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_data_id.cs @@ -0,0 +1,72 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_data_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_data_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_data_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + var serviceEndpoints = new WolverineWebApi.ServiceEndpoints(); + + // The actual HTTP request handler execution + var data_response = await serviceEndpoints.GetData(id, documentSession).ConfigureAwait(false); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, data_response); + } + + } + + // END: GET_data_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_discovered.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_discovered.cs new file mode 100644 index 000000000..87e73c1c0 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_discovered.cs @@ -0,0 +1,38 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_discovered + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_discovered : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_discovered(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + + // The actual HTTP request handler execution + var result_of_Get = WolverineWebApi.DiscoverMe.Get(); + + await WriteString(httpContext, result_of_Get); + } + + } + + // END: GET_discovered + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_document_attribute_only_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_document_attribute_only_id.cs new file mode 100644 index 000000000..24767e464 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_document_attribute_only_id.cs @@ -0,0 +1,87 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_document_required_document_attribute_only_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_document_required_document_attribute_only_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_document_required_document_attribute_only_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var invoice = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (invoice == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + var problemDetails1 = WolverineWebApi.Marten.DocumentRequiredEndpoint.Load(invoice); + // Evaluate whether the processing should stop if there are any problems + if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) + { + await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var invoice_response = WolverineWebApi.Marten.DocumentRequiredEndpoint.DocumentAttributeOnly(invoice); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, invoice_response); + } + + } + + // END: GET_document_required_document_attribute_only_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_separate_attributes_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_separate_attributes_id.cs new file mode 100644 index 000000000..56bfb39de --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_separate_attributes_id.cs @@ -0,0 +1,87 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_document_required_separate_attributes_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_document_required_separate_attributes_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_document_required_separate_attributes_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var invoice = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (invoice == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + var problemDetails1 = WolverineWebApi.Marten.DocumentRequiredEndpoint.Load(invoice); + // Evaluate whether the processing should stop if there are any problems + if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) + { + await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var invoice_response = WolverineWebApi.Marten.DocumentRequiredEndpoint.SeparateAttributes(invoice); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, invoice_response); + } + + } + + // END: GET_document_required_separate_attributes_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_enum_direction.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_enum_direction.cs new file mode 100644 index 000000000..de0f6c891 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_enum_direction.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_enum_direction + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_enum_direction : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_enum_direction(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string direction_rawValue = (string?)httpContext.GetRouteValue("direction"); + WolverineWebApi.Direction direction = default; + + if (WolverineWebApi.Direction.TryParse(direction_rawValue, true, out direction)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var fakeEndpoint = new WolverineWebApi.FakeEndpoint(); + + // The actual HTTP request handler execution + var result_of_ReadEnumArgument = fakeEndpoint.ReadEnumArgument(direction); + + await WriteString(httpContext, result_of_ReadEnumArgument); + } + + } + + // END: GET_enum_direction + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_accepts.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_accepts.cs new file mode 100644 index 000000000..6ef413270 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_accepts.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_headers_accepts + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_headers_accepts : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_headers_accepts(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var accepts = ReadSingleHeaderValue(httpContext, "accepts"); + var day = ReadSingleHeaderValue(httpContext, "x-day"); + WolverineWebApi.HeaderUsingEndpoint.Before(day); + var headerUsingEndpoint = new WolverineWebApi.HeaderUsingEndpoint(); + + // The actual HTTP request handler execution + var result_of_GetETag = headerUsingEndpoint.GetETag(accepts); + + await WriteString(httpContext, result_of_GetETag); + } + + } + + // END: GET_headers_accepts + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_int.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_int.cs new file mode 100644 index 000000000..1a11fd54d --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_int.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_headers_int + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_headers_int : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_headers_int(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string number_rawValue = ReadSingleHeaderValue(httpContext, "x-wolverine"); + int number = default; + + if (number_rawValue != null && int.TryParse(number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out number)) + { + + } + + var day = ReadSingleHeaderValue(httpContext, "x-day"); + WolverineWebApi.HeaderUsingEndpoint.Before(day); + var headerUsingEndpoint = new WolverineWebApi.HeaderUsingEndpoint(); + + // The actual HTTP request handler execution + var result_of_Get = headerUsingEndpoint.Get(number); + + await WriteString(httpContext, result_of_Get); + } + + } + + // END: GET_headers_int + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_simple.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_simple.cs new file mode 100644 index 000000000..c59441ad5 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_simple.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_headers_simple + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_headers_simple : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_headers_simple(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var name = ReadSingleHeaderValue(httpContext, "x-wolverine"); + var day = ReadSingleHeaderValue(httpContext, "x-day"); + WolverineWebApi.HeaderUsingEndpoint.Before(day); + var headerUsingEndpoint = new WolverineWebApi.HeaderUsingEndpoint(); + + // The actual HTTP request handler execution + var result_of_Get = headerUsingEndpoint.Get(name); + + await WriteString(httpContext, result_of_Get); + } + + } + + // END: GET_headers_simple + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_hello.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_hello.cs new file mode 100644 index 000000000..5a27fe03b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_hello.cs @@ -0,0 +1,39 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_hello + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_hello : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_hello(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_Speak = WolverineWebApi.TestEndpoints.Speak(); + + await WriteString(httpContext, result_of_Speak); + } + + } + + // END: GET_hello + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_context.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_context.cs new file mode 100644 index 000000000..82d2b7949 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_context.cs @@ -0,0 +1,41 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_http_context + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_http_context : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_http_context(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); + + // The actual HTTP request handler execution + httpContextEndpoints.UseHttpContext(httpContext); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: GET_http_context + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_identifier.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_identifier.cs new file mode 100644 index 000000000..369abf8a4 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_identifier.cs @@ -0,0 +1,39 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_http_identifier + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_http_identifier : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_http_identifier(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); + + // The actual HTTP request handler execution + var result_of_UseTraceIdentifier = httpContextEndpoints.UseTraceIdentifier(httpContext.TraceIdentifier); + + await WriteString(httpContext, result_of_UseTraceIdentifier); + } + + } + + // END: GET_http_identifier + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_principal.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_principal.cs new file mode 100644 index 000000000..b9bf7d8a0 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_principal.cs @@ -0,0 +1,41 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_http_principal + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_http_principal : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_http_principal(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); + + // The actual HTTP request handler execution + httpContextEndpoints.UseClaimsPrincipal(httpContext.User); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: GET_http_principal + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_request.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_request.cs new file mode 100644 index 000000000..c55bab3f4 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_request.cs @@ -0,0 +1,41 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_http_request + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_http_request : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_http_request(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); + + // The actual HTTP request handler execution + httpContextEndpoints.UseHttpRequest(httpContext.Request); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: GET_http_request + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_response.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_response.cs new file mode 100644 index 000000000..f7a0d6654 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_response.cs @@ -0,0 +1,41 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_http_response + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_http_response : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_http_response(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); + + // The actual HTTP request handler execution + httpContextEndpoints.UseHttpResponse(httpContext.Response); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: GET_http_response + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_approved.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_approved.cs new file mode 100644 index 000000000..2d4e5db73 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_approved.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_invoices_approved + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_invoices_approved : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_invoices_approved(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var querySession = _outboxedSessionFactory.QuerySession(messageContext); + + // The actual HTTP request handler execution + var approvedInvoicedCompiledQuery = WolverineWebApi.Marten.InvoicesEndpoint.GetApproved(); + + await Marten.AspNetCore.QueryableExtensions.WriteArray>(querySession, approvedInvoicedCompiledQuery, httpContext, "application/json", 200).ConfigureAwait(false); + } + + } + + // END: GET_invoices_approved + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_count.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_count.cs new file mode 100644 index 000000000..ab0a7044f --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_count.cs @@ -0,0 +1,48 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_invoices_compiled_count + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_invoices_compiled_count : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_invoices_compiled_count(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + + // The actual HTTP request handler execution + var compiledCountQuery = WolverineWebApi.Marten.InvoicesEndpoint.GetCompiledCount(); + + var result_of_QueryAsync = await documentSession.QueryAsync(compiledCountQuery, httpContext.RequestAborted).ConfigureAwait(false); + await Wolverine.Http.HttpHandler.WriteString(httpContext, result_of_QueryAsync.ToString()).ConfigureAwait(false); + } + + } + + // END: GET_invoices_compiled_count + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_id.cs new file mode 100644 index 000000000..a53b744d9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_id.cs @@ -0,0 +1,61 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_invoices_compiled_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_invoices_compiled_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_invoices_compiled_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var querySession = _outboxedSessionFactory.QuerySession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var byIdCompiled = WolverineWebApi.Marten.InvoicesEndpoint.GetCompiled(id); + + await Marten.AspNetCore.QueryableExtensions.WriteOne(querySession, byIdCompiled, httpContext, "application/json", 200).ConfigureAwait(false); + } + + } + + // END: GET_invoices_compiled_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_id.cs new file mode 100644 index 000000000..cc20070e8 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_id.cs @@ -0,0 +1,78 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_invoices_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_invoices_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_invoices_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var invoice = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (invoice == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var invoice_response = WolverineWebApi.Marten.InvoicesEndpoint.Get(invoice); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, invoice_response); + } + + } + + // END: GET_invoices_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_soft_delete_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_soft_delete_id.cs new file mode 100644 index 000000000..95b65e2e9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_soft_delete_id.cs @@ -0,0 +1,87 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_invoices_soft_delete_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_invoices_soft_delete_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_invoices_soft_delete_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var invoice = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); + // If the document is soft deleted, set the variable to null + var invoiceMetadata = invoice != null + ? await documentSession.MetadataForAsync(invoice).ConfigureAwait(false) + : null; + if (invoiceMetadata?.Deleted == true) + { + invoice = null; + } + + // 404 if this required object is null + if (invoice == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var invoice_response = WolverineWebApi.Marten.InvoicesEndpoint.GetSoftDeleted(invoice); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, invoice_response); + } + + } + + // END: GET_invoices_soft_delete_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_message_message.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_message_message.cs new file mode 100644 index 000000000..c59735265 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_message_message.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_message_message + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_message_message : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public GET_message_message(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var message = (string?)httpContext.GetRouteValue("message"); + if(message == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + var serviceEndpoints = new WolverineWebApi.ServiceEndpoints(); + + // The actual HTTP request handler execution + var result_of_GetMessage = serviceEndpoints.GetMessage(message, _recorder); + + await WriteString(httpContext, result_of_GetMessage); + } + + } + + // END: GET_message_message + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_header.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_header.cs new file mode 100644 index 000000000..ee14f93cd --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_header.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_middleware_header + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_middleware_header : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_middleware_header(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var headerMiddleware = new WolverineWebApi.HeaderMiddleware(); + var valueEndpoint = ReadSingleHeaderValue(httpContext, "x-handler"); + var valueMiddleware = ReadSingleHeaderValue(httpContext, "x-middleware"); + var middlewareResult = headerMiddleware.Before(valueMiddleware); + var valueBefore = ReadSingleHeaderValue(httpContext, "x-before"); + var middlewareEndpoint = new WolverineWebApi.MiddlewareEndpoint(); + var beforeResult = middlewareEndpoint.Before(valueBefore); + + // The actual HTTP request handler execution + var result_response = middlewareEndpoint.HandleGet(valueEndpoint, beforeResult, middlewareResult); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, result_response); + } + + } + + // END: GET_middleware_header + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_intrinsic.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_intrinsic.cs new file mode 100644 index 000000000..4f0f9bc10 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_intrinsic.cs @@ -0,0 +1,44 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_middleware_intrinsic + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_middleware_intrinsic : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public GET_middleware_intrinsic(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + WolverineWebApi.BeforeAndAfterEndpoint.Before(_recorder); + var beforeAndAfterEndpoint = new WolverineWebApi.BeforeAndAfterEndpoint(); + + // The actual HTTP request handler execution + var result_of_GetRequest = beforeAndAfterEndpoint.GetRequest(_recorder); + + WolverineWebApi.BeforeAndAfterEndpoint.After(_recorder); + await WriteString(httpContext, result_of_GetRequest); + } + + } + + // END: GET_middleware_intrinsic + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_simple.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_simple.cs new file mode 100644 index 000000000..4ba19b579 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_simple.cs @@ -0,0 +1,44 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_middleware_simple + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_middleware_simple : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public GET_middleware_simple(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + WolverineWebApi.BeforeAndAfterMiddleware.Before(_recorder); + var middlewareEndpoints = new WolverineWebApi.MiddlewareEndpoints(); + + // The actual HTTP request handler execution + var result_of_GetRequest = middlewareEndpoints.GetRequest(_recorder); + + WolverineWebApi.BeforeAndAfterMiddleware.After(_recorder); + await WriteString(httpContext, result_of_GetRequest); + } + + } + + // END: GET_middleware_simple + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_name_name.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_name_name.cs new file mode 100644 index 000000000..9a88cdac1 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_name_name.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_name_name + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_name_name : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_name_name(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var name = (string?)httpContext.GetRouteValue("name"); + if(name == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_SimpleStringRouteArgument = WolverineWebApi.TestEndpoints.SimpleStringRouteArgument(name); + + await WriteString(httpContext, result_of_SimpleStringRouteArgument); + } + + } + + // END: GET_name_name + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_V1_0_latest_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_V1_0_latest_id.cs new file mode 100644 index 000000000..bd43480f3 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_V1_0_latest_id.cs @@ -0,0 +1,70 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_orders_V1_0_latest_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_orders_V1_0_latest_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_orders_V1_0_latest_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var order = await documentSession.Events.FetchLatest(id, httpContext.RequestAborted); + // 404 if this required object is null + if (order == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var order_response = WolverineWebApi.Marten.MarkItemEndpoint.GetLatestV1(id, order); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, order_response); + } + + } + + // END: GET_orders_V1_0_latest_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_latest_from_query.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_latest_from_query.cs new file mode 100644 index 000000000..ea0f7b91a --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_latest_from_query.cs @@ -0,0 +1,64 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_orders_latest_from_query + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_orders_latest_from_query : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_orders_latest_from_query(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = httpContext.Request.Query["id"]; + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + var order = await documentSession.Events.FetchLatest(id, httpContext.RequestAborted); + // 404 if this required object is null + if (order == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var order_response = WolverineWebApi.Marten.MarkItemEndpoint.GetLatestFromQuery(id, order); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, order_response); + } + + } + + // END: GET_orders_latest_from_query + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_latest_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_latest_id.cs new file mode 100644 index 000000000..fc26cd7de --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_orders_latest_id.cs @@ -0,0 +1,70 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_orders_latest_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_orders_latest_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_orders_latest_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var order = await documentSession.Events.FetchLatest(id, httpContext.RequestAborted); + // 404 if this required object is null + if (order == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var order_response = WolverineWebApi.Marten.MarkItemEndpoint.GetLatest(id, order); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, order_response); + } + + } + + // END: GET_orders_latest_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_enum.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_enum.cs new file mode 100644 index 000000000..29bc3330a --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_enum.cs @@ -0,0 +1,48 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_collection_enum + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_collection_enum : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_collection_enum(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var collection = new System.Collections.Generic.List(); + foreach (var collectionValue in httpContext.Request.Query["collection"]) + { + if (WolverineWebApi.Direction.TryParse(collectionValue, true, out var collectionValueParsed)) + { + collection.Add(collectionValueParsed); + } + + } + + + // The actual HTTP request handler execution + var result_of_UsingEnumCollection = WolverineWebApi.QuerystringCollectionEndpoints.UsingEnumCollection(collection); + + await WriteString(httpContext, result_of_UsingEnumCollection); + } + + } + + // END: GET_querystring_collection_enum + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_guid.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_guid.cs new file mode 100644 index 000000000..04e4e98ac --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_guid.cs @@ -0,0 +1,48 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_collection_guid + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_collection_guid : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_collection_guid(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var collection = new System.Collections.Generic.List(); + foreach (var collectionValue in httpContext.Request.Query["collection"]) + { + if (System.Guid.TryParse(collectionValue, System.Globalization.CultureInfo.InvariantCulture, out var collectionValueParsed)) + { + collection.Add(collectionValueParsed); + } + + } + + + // The actual HTTP request handler execution + var result_of_UsingGuidCollection = WolverineWebApi.QuerystringCollectionEndpoints.UsingGuidCollection(collection); + + await WriteString(httpContext, result_of_UsingGuidCollection); + } + + } + + // END: GET_querystring_collection_guid + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_int.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_int.cs new file mode 100644 index 000000000..900f07463 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_int.cs @@ -0,0 +1,48 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_collection_int + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_collection_int : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_collection_int(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var collection = new System.Collections.Generic.List(); + foreach (var collectionValue in httpContext.Request.Query["collection"]) + { + if (int.TryParse(collectionValue, System.Globalization.CultureInfo.InvariantCulture, out var collectionValueParsed)) + { + collection.Add(collectionValueParsed); + } + + } + + + // The actual HTTP request handler execution + var result_of_UsingIntCollection = WolverineWebApi.QuerystringCollectionEndpoints.UsingIntCollection(collection); + + await WriteString(httpContext, result_of_UsingIntCollection); + } + + } + + // END: GET_querystring_collection_int + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_string.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_string.cs new file mode 100644 index 000000000..27a82dc53 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_string.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_collection_string + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_collection_string : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_collection_string(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var collection = new System.Collections.Generic.List(); + collection.AddRange(httpContext.Request.Query["collection"]); + + // The actual HTTP request handler execution + var result_of_UsingStringCollection = WolverineWebApi.QuerystringCollectionEndpoints.UsingStringCollection(collection); + + await WriteString(httpContext, result_of_UsingStringCollection); + } + + } + + // END: GET_querystring_collection_string + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_dateonly.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_dateonly.cs new file mode 100644 index 000000000..d6370271b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_dateonly.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_dateonly + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_dateonly : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_dateonly(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Query["value"]; + System.DateOnly value = default; + + if (value_rawValue != null && System.DateOnly.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out value)) + { + + } + + + // The actual HTTP request handler execution + var result_of_DateOnly = WolverineWebApi.QuerystringEndpoints.DateOnly(value); + + await WriteString(httpContext, result_of_DateOnly); + } + + } + + // END: GET_querystring_dateonly + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_dateonly_nullable.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_dateonly_nullable.cs new file mode 100644 index 000000000..8b433e411 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_dateonly_nullable.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_dateonly_nullable + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_dateonly_nullable : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_dateonly_nullable(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Query["value"]; + System.Nullable value = default; + + if (value_rawValue != null && System.DateOnly.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var value_parsed)) + { + value = value_parsed; + } + + + // The actual HTTP request handler execution + var result_of_DateOnlyNullable = WolverineWebApi.QuerystringEndpoints.DateOnlyNullable(value); + + await WriteString(httpContext, result_of_DateOnlyNullable); + } + + } + + // END: GET_querystring_dateonly_nullable + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime.cs new file mode 100644 index 000000000..04d1655c8 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_datetime + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_datetime : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_datetime(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Query["value"]; + System.DateTime value = default; + + if (value_rawValue != null && System.DateTime.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out value)) + { + + } + + + // The actual HTTP request handler execution + var result_of_DateTime = WolverineWebApi.QuerystringEndpoints.DateTime(value); + + await WriteString(httpContext, result_of_DateTime); + } + + } + + // END: GET_querystring_datetime + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime2.cs new file mode 100644 index 000000000..8145b2095 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime2.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_datetime2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_datetime2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_datetime2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Query["value"]; + System.DateTime value = default; + + if (value_rawValue != null && System.DateTime.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out value)) + { + + } + + + // The actual HTTP request handler execution + var result_of_DateTime2 = WolverineWebApi.QuerystringEndpoints.DateTime2(value); + + await WriteString(httpContext, result_of_DateTime2); + } + + } + + // END: GET_querystring_datetime2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime_nullable.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime_nullable.cs new file mode 100644 index 000000000..82e297d47 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_datetime_nullable.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_datetime_nullable + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_datetime_nullable : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_datetime_nullable(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Query["value"]; + System.Nullable value = default; + + if (value_rawValue != null && System.DateTime.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var value_parsed)) + { + value = value_parsed; + } + + + // The actual HTTP request handler execution + var result_of_DateTimeNullable = WolverineWebApi.QuerystringEndpoints.DateTimeNullable(value); + + await WriteString(httpContext, result_of_DateTimeNullable); + } + + } + + // END: GET_querystring_datetime_nullable + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_decimal.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_decimal.cs new file mode 100644 index 000000000..cc7a1568a --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_decimal.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_decimal + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_decimal : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public GET_querystring_decimal(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string amount_rawValue = httpContext.Request.Query["amount"]; + System.Decimal amount = default; + + if (amount_rawValue != null && System.Decimal.TryParse(amount_rawValue, System.Globalization.CultureInfo.InvariantCulture, out amount)) + { + + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_UseQueryStringParsing = WolverineWebApi.TestEndpoints.UseQueryStringParsing(_recorder, amount); + + await WriteString(httpContext, result_of_UseQueryStringParsing); + } + + } + + // END: GET_querystring_decimal + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_enum.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_enum.cs new file mode 100644 index 000000000..9a6967711 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_enum.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_enum + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_enum : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_enum(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string direction_rawValue = httpContext.Request.Query["direction"]; + WolverineWebApi.Direction direction = default; + + if (WolverineWebApi.Direction.TryParse(direction_rawValue, true, out direction)) + { + + } + + + // The actual HTTP request handler execution + var result_of_UsingEnumQuerystring = WolverineWebApi.QuerystringEndpoints.UsingEnumQuerystring(direction); + + await WriteString(httpContext, result_of_UsingEnumQuerystring); + } + + } + + // END: GET_querystring_enum + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_explicit.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_explicit.cs new file mode 100644 index 000000000..32e99b576 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_explicit.cs @@ -0,0 +1,39 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_explicit + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_explicit : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_explicit(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var name = httpContext.Request.Query["name"]; + + // The actual HTTP request handler execution + var result_of_UsingEnumQuerystring = WolverineWebApi.QuerystringEndpoints.UsingEnumQuerystring(name); + + await WriteString(httpContext, result_of_UsingEnumQuerystring); + } + + } + + // END: GET_querystring_explicit + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int.cs new file mode 100644 index 000000000..1ee79c3ef --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_int + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_int : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public GET_querystring_int(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string age_rawValue = httpContext.Request.Query["age"]; + System.Nullable age = default; + + if (age_rawValue != null && int.TryParse(age_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var age_parsed)) + { + age = age_parsed; + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_UsingQueryStringParsing = WolverineWebApi.TestEndpoints.UsingQueryStringParsing(_recorder, age); + + await WriteString(httpContext, result_of_UsingQueryStringParsing); + } + + } + + // END: GET_querystring_int + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int_nullable.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int_nullable.cs new file mode 100644 index 000000000..c3e0e1a1b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int_nullable.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_int_nullable + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_int_nullable : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_int_nullable(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string age_rawValue = httpContext.Request.Query["age"]; + System.Nullable age = default; + + if (age_rawValue != null && int.TryParse(age_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var age_parsed)) + { + age = age_parsed; + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_UsingQueryStringParsingNullable = WolverineWebApi.TestEndpoints.UsingQueryStringParsingNullable(age); + + await WriteString(httpContext, result_of_UsingQueryStringParsingNullable); + } + + } + + // END: GET_querystring_int_nullable + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_intarray.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_intarray.cs new file mode 100644 index 000000000..0cbc676a0 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_intarray.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_intarray + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_intarray : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_intarray(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var values_List = new System.Collections.Generic.List(); + foreach (var valuesValue in httpContext.Request.Query["values"]) + { + if (int.TryParse(valuesValue, System.Globalization.CultureInfo.InvariantCulture, out var valuesValueParsed)) + { + values_List.Add(valuesValueParsed); + } + + } + + var values = values_List.ToArray(); + + // The actual HTTP request handler execution + var result_of_IntArray = WolverineWebApi.QuerystringEndpoints.IntArray(values); + + await WriteString(httpContext, result_of_IntArray); + } + + } + + // END: GET_querystring_intarray + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_string.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_string.cs new file mode 100644 index 000000000..2ab6ab95e --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_string.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_string + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_string : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_string(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var name = httpContext.Request.Query["name"]; + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_UsingQueryString = WolverineWebApi.TestEndpoints.UsingQueryString(name); + + await WriteString(httpContext, result_of_UsingQueryString); + } + + } + + // END: GET_querystring_string + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_stringarray.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_stringarray.cs new file mode 100644 index 000000000..b85f85aa6 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_stringarray.cs @@ -0,0 +1,39 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_querystring_stringarray + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_querystring_stringarray : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_querystring_stringarray(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var values = httpContext.Request.Query["values"].ToArray(); + + // The actual HTTP request handler execution + var result_of_StringArray = WolverineWebApi.QuerystringEndpoints.StringArray(values); + + await WriteString(httpContext, result_of_StringArray); + } + + } + + // END: GET_querystring_stringarray + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result.cs new file mode 100644 index 000000000..a512d0933 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result.cs @@ -0,0 +1,38 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_result + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_result : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_result(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + + // The actual HTTP request handler execution + var result = WolverineWebApi.ResultEndpoints.GetResult(); + + return result.ExecuteAsync(httpContext); + } + + } + + // END: GET_result + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result_async.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result_async.cs new file mode 100644 index 000000000..5631568a9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result_async.cs @@ -0,0 +1,38 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_result_async + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_result_async : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_result_async(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + + // The actual HTTP request handler execution + var result = await WolverineWebApi.ResultEndpoints.GetAsyncResult().ConfigureAwait(false); + + await result.ExecuteAsync(httpContext).ConfigureAwait(false); + } + + } + + // END: GET_result_async + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_results_static.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_results_static.cs new file mode 100644 index 000000000..bf8dd1528 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_results_static.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_results_static + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_results_static : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_results_static(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var arithmeticResults_response = WolverineWebApi.TestEndpoints.FetchStaticResults(); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, arithmeticResults_response); + } + + } + + // END: GET_results_static + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_thing_blue.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_thing_blue.cs new file mode 100644 index 000000000..2d7414ac4 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_thing_blue.cs @@ -0,0 +1,39 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_thing_blue + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_thing_blue : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_thing_blue(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var blueThing = new WolverineWebApi.BlueThing(); + + // The actual HTTP request handler execution + var result_of_GetBlue = WolverineWebApi.ThingEndpoint.GetBlue(blueThing); + + await WriteString(httpContext, result_of_GetBlue); + } + + } + + // END: GET_thing_blue + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_thing_red.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_thing_red.cs new file mode 100644 index 000000000..f8e50c949 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_thing_red.cs @@ -0,0 +1,41 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_thing_red + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_thing_red : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.IThing _thing; + + public GET_thing_red(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, [Microsoft.Extensions.DependencyInjection.FromKeyedServices("Red")] WolverineWebApi.IThing thing) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _thing = thing; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + + // The actual HTTP request handler execution + var result_of_GetRed = WolverineWebApi.ThingEndpoint.GetRed(_thing); + + await WriteString(httpContext, result_of_GetRed); + } + + } + + // END: GET_thing_red + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_wildcard_name.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_wildcard_name.cs new file mode 100644 index 000000000..b73b42e11 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_wildcard_name.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_wildcard_name + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_wildcard_name : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public GET_wildcard_name(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var name = (string?)httpContext.GetRouteValue("name"); + if(name == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + var wildcardEndpoint = new WolverineWebApi.WildcardEndpoint(); + + // The actual HTTP request handler execution + var result_of_Wildcard = wildcardEndpoint.Wildcard(name); + + await WriteString(httpContext, result_of_Wildcard); + } + + } + + // END: GET_wildcard_name + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_write_to_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_write_to_id.cs new file mode 100644 index 000000000..498ba8f89 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_write_to_id.cs @@ -0,0 +1,62 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: GET_write_to_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class GET_write_to_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public GET_write_to_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var querySession = _outboxedSessionFactory.QuerySession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + await WolverineWebApi.WriteToEndpoints.GetAssetCodeView(id, querySession, httpContext).ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: GET_write_to_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage1Handler862252953.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage1Handler862252953.cs new file mode 100644 index 000000000..6a085e6b7 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage1Handler862252953.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: HttpMessage1Handler862252953 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class HttpMessage1Handler862252953 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var httpMessage1 = (WolverineWebApi.HttpMessage1)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MessageHandler"); + + // The actual message execution + WolverineWebApi.MessageHandler.Handle(httpMessage1); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: HttpMessage1Handler862252953 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage2Handler1265537480.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage2Handler1265537480.cs new file mode 100644 index 000000000..67484e9a9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage2Handler1265537480.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: HttpMessage2Handler1265537480 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class HttpMessage2Handler1265537480 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var httpMessage2 = (WolverineWebApi.HttpMessage2)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MessageHandler"); + + // The actual message execution + WolverineWebApi.MessageHandler.Handle(httpMessage2); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: HttpMessage2Handler1265537480 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage3Handler300546461.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage3Handler300546461.cs new file mode 100644 index 000000000..12cb911f9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage3Handler300546461.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: HttpMessage3Handler300546461 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class HttpMessage3Handler300546461 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var httpMessage3 = (WolverineWebApi.HttpMessage3)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MessageHandler"); + + // The actual message execution + WolverineWebApi.MessageHandler.Handle(httpMessage3); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: HttpMessage3Handler300546461 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage4Handler102738066.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage4Handler102738066.cs new file mode 100644 index 000000000..eef29dea6 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage4Handler102738066.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: HttpMessage4Handler102738066 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class HttpMessage4Handler102738066 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var httpMessage4 = (WolverineWebApi.HttpMessage4)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MessageHandler"); + + // The actual message execution + WolverineWebApi.MessageHandler.Handle(httpMessage4); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: HttpMessage4Handler102738066 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage5Handler1463345875.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage5Handler1463345875.cs new file mode 100644 index 000000000..6c3684f02 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage5Handler1463345875.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: HttpMessage5Handler1463345875 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class HttpMessage5Handler1463345875 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var httpMessage5 = (WolverineWebApi.HttpMessage5)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MessageHandler"); + + // The actual message execution + WolverineWebApi.MessageHandler.Handle(httpMessage5); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: HttpMessage5Handler1463345875 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/ItemCreatedHandler179438836.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/ItemCreatedHandler179438836.cs new file mode 100644 index 000000000..d94ae2688 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/ItemCreatedHandler179438836.cs @@ -0,0 +1,32 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: ItemCreatedHandler179438836 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class ItemCreatedHandler179438836 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var itemCreated = (WolverineWebApi.ItemCreated)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.ItemCreatedHandler"); + var itemCreatedHandler = new WolverineWebApi.ItemCreatedHandler(); + + // The actual message execution + itemCreatedHandler.Handle(itemCreated); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: ItemCreatedHandler179438836 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/MessageThatAlwaysGoesToDeadLetterHandler1388008025.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/MessageThatAlwaysGoesToDeadLetterHandler1388008025.cs new file mode 100644 index 000000000..bd4959a03 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/MessageThatAlwaysGoesToDeadLetterHandler1388008025.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: MessageThatAlwaysGoesToDeadLetterHandler1388008025 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class MessageThatAlwaysGoesToDeadLetterHandler1388008025 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var messageThatAlwaysGoesToDeadLetter = (WolverineWebApi.MessageThatAlwaysGoesToDeadLetter)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.MessageHandler"); + + // The actual message execution + WolverineWebApi.MessageHandler.Handle(messageThatAlwaysGoesToDeadLetter); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: MessageThatAlwaysGoesToDeadLetterHandler1388008025 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/NumberMessageHandler722393759.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/NumberMessageHandler722393759.cs new file mode 100644 index 000000000..616ec33e0 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/NumberMessageHandler722393759.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Microsoft.Extensions.Logging; + +namespace Internal.Generated.WolverineHandlers +{ + // START: NumberMessageHandler722393759 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class NumberMessageHandler722393759 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Microsoft.Extensions.Logging.ILogger _loggerForMessage; + + public NumberMessageHandler722393759(Microsoft.Extensions.Logging.ILogger loggerForMessage) + { + _loggerForMessage = loggerForMessage; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var numberMessage = (WolverineWebApi.NumberMessage)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.NumberMessageHandler"); + var problemDetails = WolverineWebApi.NumberMessageHandler.Validate(numberMessage); + // Evaluate whether the processing should stop if there are any problems + if (!(ReferenceEquals(problemDetails, Wolverine.Http.WolverineContinue.NoProblems))) + { + Wolverine.Http.CodeGen.ProblemDetailsContinuationPolicy.WriteProblems(((Microsoft.Extensions.Logging.ILogger)_loggerForMessage), problemDetails); + return; + } + + + + // The actual message execution + WolverineWebApi.NumberMessageHandler.Handle(numberMessage); + + } + + } + + // END: NumberMessageHandler722393759 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_asparameters1.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_asparameters1.cs new file mode 100644 index 000000000..b45f797cd --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_asparameters1.cs @@ -0,0 +1,114 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_asparameters1 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_asparameters1 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_api_asparameters1(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Binding Form & Querystring values to the argument marked with [AsParameters] + var asParametersQuery = new WolverineWebApi.AsParametersQuery(); + string EnumFromQuery_rawValue = httpContext.Request.Query["EnumFromQuery"]; + + if (WolverineWebApi.Direction.TryParse(EnumFromQuery_rawValue, true, out var EnumFromQuery)) + { + asParametersQuery.EnumFromQuery = EnumFromQuery; + } + + string EnumFromForm_rawValue = httpContext.Request.Form["EnumFromForm"]; + + if (WolverineWebApi.Direction.TryParse(EnumFromForm_rawValue, true, out var EnumFromForm)) + { + asParametersQuery.EnumFromForm = EnumFromForm; + } + + asParametersQuery.StringFromQuery = httpContext.Request.Query["StringFromQuery"]; + asParametersQuery.StringFromForm = httpContext.Request.Form["StringFromForm"]; + string IntegerFromQuery_rawValue = httpContext.Request.Query["IntegerFromQuery"]; + + if (IntegerFromQuery_rawValue != null && int.TryParse(IntegerFromQuery_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var IntegerFromQuery)) + { + asParametersQuery.IntegerFromQuery = IntegerFromQuery; + } + + string IntegerFromForm_rawValue = httpContext.Request.Form["IntegerFromForm"]; + + if (IntegerFromForm_rawValue != null && int.TryParse(IntegerFromForm_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var IntegerFromForm)) + { + asParametersQuery.IntegerFromForm = IntegerFromForm; + } + + string FloatFromQuery_rawValue = httpContext.Request.Query["FloatFromQuery"]; + + if (FloatFromQuery_rawValue != null && System.Single.TryParse(FloatFromQuery_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var FloatFromQuery)) + { + asParametersQuery.FloatFromQuery = FloatFromQuery; + } + + string FloatFromForm_rawValue = httpContext.Request.Form["FloatFromForm"]; + + if (FloatFromForm_rawValue != null && System.Single.TryParse(FloatFromForm_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var FloatFromForm)) + { + asParametersQuery.FloatFromForm = FloatFromForm; + } + + string BooleanFromQuery_rawValue = httpContext.Request.Query["BooleanFromQuery"]; + + if (bool.TryParse(BooleanFromQuery_rawValue, out var BooleanFromQuery)) + { + asParametersQuery.BooleanFromQuery = BooleanFromQuery; + } + + string BooleanFromForm_rawValue = httpContext.Request.Form["BooleanFromForm"]; + + if (bool.TryParse(BooleanFromForm_rawValue, out var BooleanFromForm)) + { + asParametersQuery.BooleanFromForm = BooleanFromForm; + } + + asParametersQuery.StringHeader = ReadSingleHeaderValue(httpContext, "x-string"); + string NumberHeader_rawValue = ReadSingleHeaderValue(httpContext, "x-number"); + + if (NumberHeader_rawValue != null && int.TryParse(NumberHeader_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var NumberHeader)) + { + asParametersQuery.NumberHeader = NumberHeader; + } + + string NullableHeader_rawValue = ReadSingleHeaderValue(httpContext, "x-nullable-number"); + + if (NullableHeader_rawValue != null && int.TryParse(NullableHeader_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var NullableHeader_parsed)) + { + asParametersQuery.NullableHeader = NullableHeader_parsed; + } + + + // The actual HTTP request handler execution + var asParametersQuery_response = WolverineWebApi.AsParametersEndpoints.Post(asParametersQuery); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, asParametersQuery_response); + } + + } + + // END: POST_api_asparameters1 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform1.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform1.cs new file mode 100644 index 000000000..39a737fb0 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform1.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_fromform1 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_fromform1 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_api_fromform1(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var Name = httpContext.Request.Form["Name"]; + // Binding Form values to the argument marked with [FromForm] + var query1 = new WolverineWebApi.Query1(Name); + + // The actual HTTP request handler execution + var query1_response = WolverineWebApi.FromFormEndpoints.Post(query1); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, query1_response); + } + + } + + // END: POST_api_fromform1 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform2.cs new file mode 100644 index 000000000..0f5c4e70d --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform2.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_fromform2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_fromform2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_api_fromform2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string Number_rawValue = httpContext.Request.Form["Number"]; + int Number = default; + + if (Number_rawValue != null && int.TryParse(Number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out Number)) + { + + } + + // Binding Form values to the argument marked with [FromForm] + var query2 = new WolverineWebApi.Query2(Number); + + // The actual HTTP request handler execution + var query2_response = WolverineWebApi.FromFormEndpoints.Post(query2); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, query2_response); + } + + } + + // END: POST_api_fromform2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform3.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform3.cs new file mode 100644 index 000000000..6f40308de --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform3.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_fromform3 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_fromform3 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_api_fromform3(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string Id_rawValue = httpContext.Request.Form["Id"]; + System.Guid Id = default; + + if (Id_rawValue != null && System.Guid.TryParse(Id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out Id)) + { + + } + + // Binding Form values to the argument marked with [FromForm] + var query3 = new WolverineWebApi.Query3(Id); + + // The actual HTTP request handler execution + var query3_response = WolverineWebApi.FromFormEndpoints.Post(query3); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, query3_response); + } + + } + + // END: POST_api_fromform3 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform4.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform4.cs new file mode 100644 index 000000000..53a98a40c --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromform4.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_fromform4 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_fromform4 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_api_fromform4(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string Direction_rawValue = httpContext.Request.Form["Direction"]; + WolverineWebApi.Direction Direction = default; + + if (WolverineWebApi.Direction.TryParse(Direction_rawValue, true, out Direction)) + { + + } + + string Number_rawValue = httpContext.Request.Form["Number"]; + int Number = default; + + if (Number_rawValue != null && int.TryParse(Number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out Number)) + { + + } + + var Name = httpContext.Request.Form["Name"]; + // Binding Form values to the argument marked with [FromForm] + var query4 = new WolverineWebApi.Query4(Name, Number, Direction); + + // The actual HTTP request handler execution + var query4_response = WolverineWebApi.FromFormEndpoints.Post(query4); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, query4_response); + } + + } + + // END: POST_api_fromform4 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromformbigquery.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromformbigquery.cs new file mode 100644 index 000000000..42c68675c --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_fromformbigquery.cs @@ -0,0 +1,119 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_fromformbigquery + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_fromformbigquery : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_api_fromformbigquery(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Binding Form values to the argument marked with [FromForm] + var bigQuery = new WolverineWebApi.BigQuery(); + bigQuery.Name = httpContext.Request.Form["Name"]; + string Number_rawValue = httpContext.Request.Form["Number"]; + + if (Number_rawValue != null && int.TryParse(Number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var Number)) + { + bigQuery.Number = Number; + } + + string Direction_rawValue = httpContext.Request.Form["Direction"]; + + if (WolverineWebApi.Direction.TryParse(Direction_rawValue, true, out var Direction)) + { + bigQuery.Direction = Direction; + } + + bigQuery.Values = httpContext.Request.Form["Values"].ToArray(); + var Numbers_List = new System.Collections.Generic.List(); + foreach (var NumbersValue in httpContext.Request.Form["Numbers"]) + { + if (int.TryParse(NumbersValue, System.Globalization.CultureInfo.InvariantCulture, out var NumbersValueParsed)) + { + Numbers_List.Add(NumbersValueParsed); + } + + } + + if (Numbers_List.Any()) bigQuery.Numbers = Numbers_List.ToArray(); + string Flag_rawValue = httpContext.Request.Form["Flag"]; + + if (bool.TryParse(Flag_rawValue, out var Flag)) + { + bigQuery.Flag = Flag; + } + + string NullableNumber_rawValue = httpContext.Request.Form["NullableNumber"]; + + if (NullableNumber_rawValue != null && int.TryParse(NullableNumber_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var NullableNumber_parsed)) + { + bigQuery.NullableNumber = NullableNumber_parsed; + } + + string NullableDirection_rawValue = httpContext.Request.Form["NullableDirection"]; + + if (WolverineWebApi.Direction.TryParse(NullableDirection_rawValue, true, out var NullableDirection_parsed)) + { + bigQuery.NullableDirection = NullableDirection_parsed; + } + + string NullableFlag_rawValue = httpContext.Request.Form["NullableFlag"]; + + if (bool.TryParse(NullableFlag_rawValue, out var NullableFlag_parsed)) + { + bigQuery.NullableFlag = NullableFlag_parsed; + } + + bigQuery.ValueWithAlias = httpContext.Request.Form["aliased"]; + bigQuery.ListValues = new System.Collections.Generic.List(); + bigQuery.ListValues.AddRange(httpContext.Request.Form["ListValues"]); + bigQuery.EnumListValues = new System.Collections.Generic.List(); + foreach (var EnumListValuesValue in httpContext.Request.Form["EnumListValues"]) + { + if (WolverineWebApi.Direction.TryParse(EnumListValuesValue, true, out var EnumListValuesValueParsed)) + { + bigQuery.EnumListValues.Add(EnumListValuesValueParsed); + } + + } + + bigQuery.IntList = new System.Collections.Generic.List(); + foreach (var IntListValue in httpContext.Request.Form["IntList"]) + { + if (int.TryParse(IntListValue, System.Globalization.CultureInfo.InvariantCulture, out var IntListValueParsed)) + { + bigQuery.IntList.Add(IntListValueParsed); + } + + } + + + // The actual HTTP request handler execution + var bigQuery_response = WolverineWebApi.FromFormEndpoints.Post(bigQuery); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, bigQuery_response); + } + + } + + // END: POST_api_fromformbigquery + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo2_id_something.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo2_id_something.cs new file mode 100644 index 000000000..3e3e22edc --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo2_id_something.cs @@ -0,0 +1,69 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo2_id_something + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo2_id_something : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo2_id_something(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + var Id = (string?)httpContext.GetRouteValue("Id"); + if(Id == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(Id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (todo2 == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var result = await WolverineWebApi.Marten.TodoEndpoint.Handle(todo2, messageContext).ConfigureAwait(false); + + await result.ExecuteAsync(httpContext).ConfigureAwait(false); + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_api_todo2_id_something + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_complete.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_complete.cs new file mode 100644 index 000000000..cc5282792 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_complete.cs @@ -0,0 +1,74 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_complete + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_complete : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_complete(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(command.Id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (todo2 == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var storageAction = WolverineWebApi.Todos.TodoHandler.Handle(command, todo2); + + if (storageAction != null) + { + Wolverine.Marten.Persistence.Sagas.MartenStorageActionApplier.ApplyAction(documentSession, storageAction); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_complete + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_create.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_create.cs new file mode 100644 index 000000000..44f04fd33 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_create.cs @@ -0,0 +1,66 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_create + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_create : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_create(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + var insert = WolverineWebApi.Todos.TodoHandler.Handle(command); + + if (insert != null) + { + + // Register the document operation with the current session + documentSession.Insert(insert.Entity); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_create + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_create2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_create2.cs new file mode 100644 index 000000000..701fce9d4 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_create2.cs @@ -0,0 +1,66 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_create2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_create2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_create2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + var store = WolverineWebApi.Todos.TodoHandler.Handle(command); + + if (store != null) + { + + // Register the document operation with the current session + documentSession.Store(store.Entity); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_create2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_examinefirst.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_examinefirst.cs new file mode 100644 index 000000000..e904c9479 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_examinefirst.cs @@ -0,0 +1,70 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_examinefirst + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_examinefirst : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_examinefirst(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(command.Todo2Id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (todo2 == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + var result1 = WolverineWebApi.Todos.ExamineFirstHandler.Before(todo2); + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + WolverineWebApi.Todos.ExamineFirstHandler.Handle(command); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_examinefirst + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybecomplete.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybecomplete.cs new file mode 100644 index 000000000..304703491 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybecomplete.cs @@ -0,0 +1,67 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_maybecomplete + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_maybecomplete : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_maybecomplete(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(command.Id, httpContext.RequestAborted).ConfigureAwait(false); + + // The actual HTTP request handler execution + var storageAction = WolverineWebApi.Todos.TodoHandler.Handle(command, todo2); + + if (storageAction != null) + { + Wolverine.Marten.Persistence.Sagas.MartenStorageActionApplier.ApplyAction(documentSession, storageAction); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_maybecomplete + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybeinsert.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybeinsert.cs new file mode 100644 index 000000000..95b8178d7 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybeinsert.cs @@ -0,0 +1,64 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_maybeinsert + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_maybeinsert : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_maybeinsert(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + var storageAction = WolverineWebApi.Todos.TodoHandler.Handle(command); + + if (storageAction != null) + { + Wolverine.Marten.Persistence.Sagas.MartenStorageActionApplier.ApplyAction(documentSession, storageAction); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_maybeinsert + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybetaskcompletewithbeforeusage.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybetaskcompletewithbeforeusage.cs new file mode 100644 index 000000000..80af15ada --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_maybetaskcompletewithbeforeusage.cs @@ -0,0 +1,77 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_maybetaskcompletewithbeforeusage + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_maybetaskcompletewithbeforeusage : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_maybetaskcompletewithbeforeusage(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(command.Id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (todo2 == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + WolverineWebApi.Todos.MarkTaskCompleteIfBrokenHandler.Before(todo2); + + // The actual HTTP request handler execution + var update = WolverineWebApi.Todos.MarkTaskCompleteIfBrokenHandler.Handle(command, todo2); + + if (update != null) + { + + // Register the document operation with the current session + documentSession.Update(update.Entity); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_maybetaskcompletewithbeforeusage + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_nullaction.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_nullaction.cs new file mode 100644 index 000000000..16de51b77 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_nullaction.cs @@ -0,0 +1,64 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_nullaction + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_nullaction : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_nullaction(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + var storageAction = WolverineWebApi.Todos.TodoHandler.Handle(command); + + if (storageAction != null) + { + Wolverine.Marten.Persistence.Sagas.MartenStorageActionApplier.ApplyAction(documentSession, storageAction); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_nullaction + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_nullinsert.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_nullinsert.cs new file mode 100644 index 000000000..5cd2c75a5 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_nullinsert.cs @@ -0,0 +1,66 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_nullinsert + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_nullinsert : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_nullinsert(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + var insert = WolverineWebApi.Todos.TodoHandler.Handle(command); + + if (insert != null) + { + + // Register the document operation with the current session + documentSession.Insert(insert.Entity); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_nullinsert + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update.cs new file mode 100644 index 000000000..22988b1a9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update.cs @@ -0,0 +1,76 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_update + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_update : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_update(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(command.Id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (todo2 == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var update = WolverineWebApi.Todos.TodoHandler.Handle(command, todo2); + + if (update != null) + { + + // Register the document operation with the current session + documentSession.Update(update.Entity); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_update + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update2.cs new file mode 100644 index 000000000..8195ecde9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update2.cs @@ -0,0 +1,76 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_update2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_update2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_update2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(command.Todo2Id, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (todo2 == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var update = WolverineWebApi.Todos.TodoHandler.Handle(command, todo2); + + if (update != null) + { + + // Register the document operation with the current session + documentSession.Update(update.Entity); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_update2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update3.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update3.cs new file mode 100644 index 000000000..10c6dbd7d --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_api_todo_update3.cs @@ -0,0 +1,76 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_api_todo_update3 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_api_todo_update3 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_api_todo_update3(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Try to load the existing saga document + var todo2 = await documentSession.LoadAsync(command.Identity, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (todo2 == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var update = WolverineWebApi.Todos.TodoHandler.Handle(command, todo2); + + if (update != null) + { + + // Register the document operation with the current session + documentSession.Update(update.Entity); + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_api_todo_update3 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_asp2_id_number.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_asp2_id_number.cs new file mode 100644 index 000000000..e9d9368af --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_asp2_id_number.cs @@ -0,0 +1,69 @@ +// +#pragma warning disable +using Marten; +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_asp2_id_number + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_asp2_id_number : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Marten.IDocumentStore _documentStore; + + public POST_asp2_id_number(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Marten.IDocumentStore documentStore) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _documentStore = documentStore; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (asParameterBody, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + // Binding Form & Querystring values to the argument marked with [AsParameters] + var asParametersQuery2 = new WolverineWebApi.AsParametersQuery2(); + asParametersQuery2.Store = _documentStore; + asParametersQuery2.Body = asParameterBody; + asParametersQuery2.Id = (string?)httpContext.GetRouteValue("Id"); + if(asParametersQuery2.Id == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + string Number_rawValue = (string?)httpContext.GetRouteValue("Number"); + + if (Number_rawValue != null && int.TryParse(Number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var Number)) + { + asParametersQuery2.Number = Number; + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var asParametersQuery2_response = WolverineWebApi.AsParametersEndpoints2.Post(asParametersQuery2); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, asParametersQuery2_response); + } + + } + + // END: POST_asp2_id_number + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_asparameterrecord_Id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_asparameterrecord_Id.cs new file mode 100644 index 000000000..eded79c42 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_asparameterrecord_Id.cs @@ -0,0 +1,72 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_asparameterrecord_Id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_asparameterrecord_Id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_asparameterrecord_Id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Binding Form & Querystring values to the argument marked with [AsParameters] + var Id = (string?)httpContext.GetRouteValue("Id"); + if(Id == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + string Number_rawValue = httpContext.Request.Query["Number"]; + int Number = default; + + if (Number_rawValue != null && int.TryParse(Number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out Number)) + { + + } + + string Direction_rawValue = ReadSingleHeaderValue(httpContext, "x-direction"); + WolverineWebApi.Direction Direction = default; + + if (WolverineWebApi.Direction.TryParse(Direction_rawValue, true, out Direction)) + { + + } + + string test_rawValue = httpContext.Request.Form["test"]; + bool test = default; + + if (bool.TryParse(test_rawValue, out test)) + { + + } + + var asParameterRecord = new WolverineWebApi.AsParameterRecord(Id, Number, Direction, test); + + // The actual HTTP request handler execution + var asParameterRecord_response = WolverineWebApi.AsParameterRecordEndpoint.Post(asParameterRecord); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, asParameterRecord_response); + } + + } + + // END: POST_asparameterrecord_Id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_authenticated.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_authenticated.cs new file mode 100644 index 000000000..cf2698fb9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_authenticated.cs @@ -0,0 +1,52 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_authenticated + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_authenticated : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_authenticated(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var fakeAuthenticationMiddleware = new WolverineWebApi.FakeAuthenticationMiddleware(); + // Reading the request body via JSON deserialization + var (request, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var result1 = WolverineWebApi.FakeAuthenticationMiddleware.Before(request); + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + var authenticatedEndpoint = new WolverineWebApi.AuthenticatedEndpoint(); + + // The actual HTTP request handler execution + var result_of_Get = authenticatedEndpoint.Get(request); + + await WriteString(httpContext, result_of_Get); + } + + } + + // END: POST_authenticated + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_convert_book.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_convert_book.cs new file mode 100644 index 000000000..d56e268d3 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_convert_book.cs @@ -0,0 +1,51 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_convert_book + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_convert_book : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + + public POST_convert_book(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + // Reading the request body via JSON deserialization + var (@event, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + await WolverineWebApi.Bugs.ConvertBookEndpoint.Post(@event, messageContext, httpContext.RequestAborted).ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_convert_book + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_discovered_fsharp_unit.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_discovered_fsharp_unit.cs new file mode 100644 index 000000000..2ea817cb3 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_discovered_fsharp_unit.cs @@ -0,0 +1,39 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_discovered_fsharp_unit + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_discovered_fsharp_unit : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_discovered_fsharp_unit(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + + // The actual HTTP request handler execution + var unit = await WolverineWebApiFSharp.DiscoverFSharp.myHandler().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_discovered_fsharp_unit + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_create.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_create.cs new file mode 100644 index 000000000..56b2b7403 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_create.cs @@ -0,0 +1,61 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_ef_create + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_ef_create : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Microsoft.EntityFrameworkCore.DbContextOptions _dbContextOptions; + + public POST_ef_create(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Microsoft.EntityFrameworkCore.DbContextOptions dbContextOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _dbContextOptions = dbContextOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + await using var itemsDbContext = new WolverineWebApi.ItemsDbContext(_dbContextOptions); + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + + // Enroll the DbContext & IMessagingContext in the outgoing Wolverine outbox transaction + var envelopeTransaction = Wolverine.EntityFrameworkCore.WolverineEntityCoreExtensions.BuildTransaction(itemsDbContext, messageContext); + await messageContext.EnlistInOutboxAsync(envelopeTransaction); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var efCoreEndpoints = new WolverineWebApi.EfCoreEndpoints(); + + // The actual HTTP request handler execution + efCoreEndpoints.CreateItem(command, itemsDbContext); + + + // Added by EF Core Transaction Middleware + var result_of_SaveChangesAsync = await itemsDbContext.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + // If we have separate context for outbox and application, then we need to manually commit the transaction + if (envelopeTransaction is Wolverine.EntityFrameworkCore.Internals.RawDatabaseEnvelopeTransaction rawTx) { await rawTx.CommitAsync(); } + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_ef_create + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_publish.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_publish.cs new file mode 100644 index 000000000..6b705cee9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_publish.cs @@ -0,0 +1,66 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_ef_publish + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_ef_publish : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Microsoft.EntityFrameworkCore.DbContextOptions _dbContextOptions; + + public POST_ef_publish(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Microsoft.EntityFrameworkCore.DbContextOptions dbContextOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _dbContextOptions = dbContextOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + await using var itemsDbContext = new WolverineWebApi.ItemsDbContext(_dbContextOptions); + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + + // Enroll the DbContext & IMessagingContext in the outgoing Wolverine outbox transaction + var envelopeTransaction = Wolverine.EntityFrameworkCore.WolverineEntityCoreExtensions.BuildTransaction(itemsDbContext, messageContext); + await messageContext.EnlistInOutboxAsync(envelopeTransaction); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var efCoreEndpoints = new WolverineWebApi.EfCoreEndpoints(); + + // The actual HTTP request handler execution + await efCoreEndpoints.PublishItem(command, itemsDbContext, messageContext).ConfigureAwait(false); + + + // Added by EF Core Transaction Middleware + var result_of_SaveChangesAsync = await itemsDbContext.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + // If we have separate context for outbox and application, then we need to manually commit the transaction + if (envelopeTransaction is Wolverine.EntityFrameworkCore.Internals.RawDatabaseEnvelopeTransaction rawTx) { await rawTx.CommitAsync(); } + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_ef_publish + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_dateonly.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_dateonly.cs new file mode 100644 index 000000000..bff4991b3 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_dateonly.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_dateonly + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_dateonly : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_dateonly(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Form["value"]; + System.DateOnly value = default; + + if (value_rawValue != null && System.DateOnly.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out value)) + { + + } + + + // The actual HTTP request handler execution + var result_of_DateOnly = WolverineWebApi.FormEndpoints.DateOnly(value); + + await WriteString(httpContext, result_of_DateOnly); + } + + } + + // END: POST_form_dateonly + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_dateonly_nullable.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_dateonly_nullable.cs new file mode 100644 index 000000000..ef5665f9e --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_dateonly_nullable.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_dateonly_nullable + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_dateonly_nullable : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_dateonly_nullable(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Form["value"]; + System.Nullable value = default; + + if (value_rawValue != null && System.DateOnly.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var value_parsed)) + { + value = value_parsed; + } + + + // The actual HTTP request handler execution + var result_of_DateOnlyNullable = WolverineWebApi.FormEndpoints.DateOnlyNullable(value); + + await WriteString(httpContext, result_of_DateOnlyNullable); + } + + } + + // END: POST_form_dateonly_nullable + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime.cs new file mode 100644 index 000000000..ee32fd41a --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_datetime + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_datetime : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_datetime(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Form["value"]; + System.DateTime value = default; + + if (value_rawValue != null && System.DateTime.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out value)) + { + + } + + + // The actual HTTP request handler execution + var result_of_DateTime = WolverineWebApi.FormEndpoints.DateTime(value); + + await WriteString(httpContext, result_of_DateTime); + } + + } + + // END: POST_form_datetime + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime2.cs new file mode 100644 index 000000000..843e9aa00 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime2.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_datetime2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_datetime2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_datetime2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Form["value"]; + System.DateTime value = default; + + if (value_rawValue != null && System.DateTime.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out value)) + { + + } + + + // The actual HTTP request handler execution + var result_of_DateTime2 = WolverineWebApi.FormEndpoints.DateTime2(value); + + await WriteString(httpContext, result_of_DateTime2); + } + + } + + // END: POST_form_datetime2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime_nullable.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime_nullable.cs new file mode 100644 index 000000000..029bc339e --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_datetime_nullable.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_datetime_nullable + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_datetime_nullable : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_datetime_nullable(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string value_rawValue = httpContext.Request.Form["value"]; + System.Nullable value = default; + + if (value_rawValue != null && System.DateTime.TryParse(value_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var value_parsed)) + { + value = value_parsed; + } + + + // The actual HTTP request handler execution + var result_of_DateTimeNullable = WolverineWebApi.FormEndpoints.DateTimeNullable(value); + + await WriteString(httpContext, result_of_DateTimeNullable); + } + + } + + // END: POST_form_datetime_nullable + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_decimal.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_decimal.cs new file mode 100644 index 000000000..19da1e94d --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_decimal.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_decimal + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_decimal : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public POST_form_decimal(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string amount_rawValue = httpContext.Request.Form["amount"]; + System.Decimal amount = default; + + if (amount_rawValue != null && System.Decimal.TryParse(amount_rawValue, System.Globalization.CultureInfo.InvariantCulture, out amount)) + { + + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_UseFormParsing = WolverineWebApi.TestEndpoints.UseFormParsing(_recorder, amount); + + await WriteString(httpContext, result_of_UseFormParsing); + } + + } + + // END: POST_form_decimal + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_enum.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_enum.cs new file mode 100644 index 000000000..11679a54b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_enum.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_enum + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_enum : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_enum(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string direction_rawValue = httpContext.Request.Form["direction"]; + WolverineWebApi.Direction direction = default; + + if (WolverineWebApi.Direction.TryParse(direction_rawValue, true, out direction)) + { + + } + + + // The actual HTTP request handler execution + var result_of_UsingEnumQuerystring = WolverineWebApi.FormEndpoints.UsingEnumQuerystring(direction); + + await WriteString(httpContext, result_of_UsingEnumQuerystring); + } + + } + + // END: POST_form_enum + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_explicit.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_explicit.cs new file mode 100644 index 000000000..8555d219b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_explicit.cs @@ -0,0 +1,39 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_explicit + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_explicit : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_explicit(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var name = httpContext.Request.Form["name"]; + + // The actual HTTP request handler execution + var result_of_UsingEnumQuerystring = WolverineWebApi.FormEndpoints.UsingEnumQuerystring(name); + + await WriteString(httpContext, result_of_UsingEnumQuerystring); + } + + } + + // END: POST_form_explicit + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_int.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_int.cs new file mode 100644 index 000000000..6b38cf8e2 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_int.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_int + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_int : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public POST_form_int(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string age_rawValue = httpContext.Request.Form["age"]; + System.Nullable age = default; + + if (age_rawValue != null && int.TryParse(age_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var age_parsed)) + { + age = age_parsed; + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_UsingFormParsing = WolverineWebApi.TestEndpoints.UsingFormParsing(_recorder, age); + + await WriteString(httpContext, result_of_UsingFormParsing); + } + + } + + // END: POST_form_int + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_int_nullable.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_int_nullable.cs new file mode 100644 index 000000000..1e6e94b6c --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_int_nullable.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_int_nullable + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_int_nullable : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_int_nullable(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string age_rawValue = httpContext.Request.Form["age"]; + System.Nullable age = default; + + if (age_rawValue != null && int.TryParse(age_rawValue, System.Globalization.CultureInfo.InvariantCulture, out var age_parsed)) + { + age = age_parsed; + } + + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_UsingFormParsingNullable = WolverineWebApi.TestEndpoints.UsingFormParsingNullable(age); + + await WriteString(httpContext, result_of_UsingFormParsingNullable); + } + + } + + // END: POST_form_int_nullable + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_string.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_string.cs new file mode 100644 index 000000000..36566482c --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_form_string.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_form_string + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_form_string : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_form_string(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var name = httpContext.Request.Form["name"]; + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var result_of_UsingForm = WolverineWebApi.TestEndpoints.UsingForm(name); + + await WriteString(httpContext, result_of_UsingForm); + } + + } + + // END: POST_form_string + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_fromservices.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_fromservices.cs new file mode 100644 index 000000000..ee6f81128 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_fromservices.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_fromservices + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_fromservices : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public POST_fromservices(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var attributeEndpoints = new WolverineWebApi.AttributeEndpoints(); + + // The actual HTTP request handler execution + var result_of_PostFromServices = attributeEndpoints.PostFromServices(_recorder); + + await WriteString(httpContext, result_of_PostFromServices); + } + + } + + // END: POST_fromservices + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_invoiceId_pay.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_invoiceId_pay.cs new file mode 100644 index 000000000..15db6f8d9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_invoiceId_pay.cs @@ -0,0 +1,86 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_invoices_invoiceId_pay + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_invoices_invoiceId_pay : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_invoices_invoiceId_pay(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string invoiceId_rawValue = (string?)httpContext.GetRouteValue("invoiceId"); + System.Guid invoiceId = default; + + if (invoiceId_rawValue != null && System.Guid.TryParse(invoiceId_rawValue, System.Globalization.CultureInfo.InvariantCulture, out invoiceId)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var invoice = await documentSession.LoadAsync(invoiceId, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (invoice == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var martenOp = WolverineWebApi.Marten.InvoicesEndpoint.Pay(invoice); + + if (martenOp != null) + { + + // Placed by Wolverine's ISideEffect policy + martenOp.Execute(documentSession); + + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_invoices_invoiceId_pay + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_number_approve.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_number_approve.cs new file mode 100644 index 000000000..0fec75c83 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_number_approve.cs @@ -0,0 +1,86 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_invoices_number_approve + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_invoices_number_approve : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_invoices_number_approve(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string number_rawValue = (string?)httpContext.GetRouteValue("number"); + System.Guid number = default; + + if (number_rawValue != null && System.Guid.TryParse(number_rawValue, System.Globalization.CultureInfo.InvariantCulture, out number)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var invoice = await documentSession.LoadAsync(number, httpContext.RequestAborted).ConfigureAwait(false); + // 404 if this required object is null + if (invoice == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var martenOp = WolverineWebApi.Marten.InvoicesEndpoint.Approve(invoice); + + if (martenOp != null) + { + + // Placed by Wolverine's ISideEffect policy + martenOp.Execute(documentSession); + + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_invoices_number_approve + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_issue.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_issue.cs new file mode 100644 index 000000000..9de9739c0 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_issue.cs @@ -0,0 +1,70 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_issue + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_issue : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_issue(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var createEndpoint = new WolverineWebApi.CreateEndpoint(); + + // The actual HTTP request handler execution + (var issueCreated_response, var insertDoc) = createEndpoint.Create(command); + + if (insertDoc != null) + { + + // Placed by Wolverine's ISideEffect policy + insertDoc.Execute(documentSession); + + } + + // This response type customizes the HTTP response + ApplyHttpAware(issueCreated_response, httpContext); + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, issueCreated_response); + } + + } + + // END: POST_issue + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_middleware_messages_name.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_middleware_messages_name.cs new file mode 100644 index 000000000..dad514f85 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_middleware_messages_name.cs @@ -0,0 +1,69 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_middleware_messages_name + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_middleware_messages_name : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_middleware_messages_name(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + var name = (string?)httpContext.GetRouteValue("name"); + if(name == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + var outgoingMessages101 = WolverineWebApi.CascadingEndpoint.Before(name); + + // Outgoing, cascaded message + await messageContext.EnqueueCascadingAsync(outgoingMessages101).ConfigureAwait(false); + + + // The actual HTTP request handler execution + var result_of_Post = WolverineWebApi.CascadingEndpoint.Post(name, documentSession); + + await WolverineWebApi.CascadingEndpoint.After(messageContext, name).ConfigureAwait(false); + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + await WriteString(httpContext, result_of_Post); + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_middleware_messages_name + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_notbody.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_notbody.cs new file mode 100644 index 000000000..20daa2e1b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_notbody.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using WolverineWebApi; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_notbody + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_notbody : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly WolverineWebApi.Recorder _recorder; + + public POST_notbody(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _recorder = recorder; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var attributeEndpoints = new WolverineWebApi.AttributeEndpoints(); + + // The actual HTTP request handler execution + var result_of_PostNotBody = attributeEndpoints.PostNotBody(_recorder); + + await WriteString(httpContext, result_of_PostNotBody); + } + + } + + // END: POST_notbody + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create.cs new file mode 100644 index 000000000..1ce4300d7 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create.cs @@ -0,0 +1,59 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_create + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_create : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_create(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + var orderStatus_response = WolverineWebApi.Marten.MarkItemEndpoint.StartOrder(command, documentSession); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, orderStatus_response); + } + + } + + // END: POST_orders_create + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create2.cs new file mode 100644 index 000000000..108a14850 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create2.cs @@ -0,0 +1,80 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_create2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_create2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_create2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Catches any existing stream id collision exceptions + try + { + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + (var orderStatus_response, var startStream) = WolverineWebApi.Marten.MarkItemEndpoint.StartOrder2(command, documentSession); + + if (startStream != null) + { + + // Placed by Wolverine's ISideEffect policy + startStream.Execute(documentSession); + + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, orderStatus_response); + } + + + catch(Marten.Exceptions.ExistingStreamIdCollisionException e) + { + await WolverineWebApi.Marten.StreamCollisionExceptionPolicy.RespondWithProblemDetails(e, httpContext); + return; + } + + + } + + } + + // END: POST_orders_create2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create3.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create3.cs new file mode 100644 index 000000000..39af54647 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create3.cs @@ -0,0 +1,82 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_create3 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_create3 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_create3(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Catches any existing stream id collision exceptions + try + { + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + (var creationResponse_response, var startStream) = WolverineWebApi.Marten.MarkItemEndpoint.StartOrder3(command); + + if (startStream != null) + { + + // Placed by Wolverine's ISideEffect policy + startStream.Execute(documentSession); + + } + + // This response type customizes the HTTP response + ApplyHttpAware(creationResponse_response, httpContext); + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, creationResponse_response); + } + + + catch(Marten.Exceptions.ExistingStreamIdCollisionException e) + { + await WolverineWebApi.Marten.StreamCollisionExceptionPolicy.RespondWithProblemDetails(e, httpContext); + return; + } + + + } + + } + + // END: POST_orders_create3 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create4.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create4.cs new file mode 100644 index 000000000..c22d176a8 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create4.cs @@ -0,0 +1,80 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_create4 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_create4 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_create4(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Catches any existing stream id collision exceptions + try + { + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + (var orderStatus_response, var startStream) = WolverineWebApi.Marten.MarkItemEndpoint.StartOrder4(command); + + if (startStream != null) + { + + // Placed by Wolverine's ISideEffect policy + startStream.Execute(documentSession); + + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, orderStatus_response); + } + + + catch(Marten.Exceptions.ExistingStreamIdCollisionException e) + { + await WolverineWebApi.Marten.StreamCollisionExceptionPolicy.RespondWithProblemDetails(e, httpContext); + return; + } + + + } + + } + + // END: POST_orders_create4 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm.cs new file mode 100644 index 000000000..1ce31d109 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm.cs @@ -0,0 +1,67 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_id_confirm + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_id_confirm : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_id_confirm(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var aggregateId = command.OrderId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, httpContext.RequestAborted).ConfigureAwait(false); + + + // The actual HTTP request handler execution + (var acceptResponse_response, var events) = WolverineWebApi.Marten.MarkItemEndpoint.Confirm(command, eventStream.Aggregate); + + if (events != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(events); + + } + + // This response type customizes the HTTP response + ApplyHttpAware(acceptResponse_response, httpContext); + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, acceptResponse_response); + } + + } + + // END: POST_orders_id_confirm + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm2.cs new file mode 100644 index 000000000..33425fc82 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm2.cs @@ -0,0 +1,67 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_id_confirm2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_id_confirm2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_id_confirm2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var aggregateId = command.OrderId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, httpContext.RequestAborted).ConfigureAwait(false); + + + // The actual HTTP request handler execution + (var updatedAggregate, var events) = WolverineWebApi.Marten.MarkItemEndpoint.ConfirmDifferent(command, eventStream.Aggregate); + + // Wolverine.Marten.UpdatedAggregate generates special response handling + if (events != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(events); + + } + + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + var order_response = await eventStoreOperations.FetchLatest(aggregateId, httpContext.RequestAborted); + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, order_response); + } + + } + + // END: POST_orders_id_confirm2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm3.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm3.cs new file mode 100644 index 000000000..2c79e0fba --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm3.cs @@ -0,0 +1,60 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_id_confirm3 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_id_confirm3 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_id_confirm3(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var aggregateId = command.OrderId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, httpContext.RequestAborted).ConfigureAwait(false); + + + // The actual HTTP request handler execution + (var updatedAggregate, var orderConfirmed) = WolverineWebApi.Marten.MarkItemEndpoint.ConfirmDifferent2(command, eventStream.Aggregate); + + // Wolverine.Marten.UpdatedAggregate generates special response handling + eventStream.AppendOne(orderConfirmed); + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + var order_response = await eventStoreOperations.FetchLatest(aggregateId, httpContext.RequestAborted); + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, order_response); + } + + } + + // END: POST_orders_id_confirm3 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_itemready.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_itemready.cs new file mode 100644 index 000000000..c21a47346 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_itemready.cs @@ -0,0 +1,73 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_itemready + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_itemready : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_itemready(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var aggregateId = command.OrderId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, command.Version, httpContext.RequestAborted).ConfigureAwait(false); + + string expectedVersion_rawValue = httpContext.Request.Query["expectedVersion"]; + long expectedVersion = default; + + if (expectedVersion_rawValue != null && long.TryParse(expectedVersion_rawValue, System.Globalization.CultureInfo.InvariantCulture, out expectedVersion)) + { + + } + + + // The actual HTTP request handler execution + (var orderStatus_response, var events) = WolverineWebApi.Marten.MarkItemEndpoint.Post(command, eventStream.Aggregate); + + if (events != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(events); + + } + + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, orderStatus_response); + } + + } + + // END: POST_orders_itemready + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship2.cs new file mode 100644 index 000000000..25dc1f953 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship2.cs @@ -0,0 +1,74 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_orderId_ship2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_orderId_ship2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_orderId_ship2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string orderId_rawValue = (string?)httpContext.GetRouteValue("orderId"); + System.Guid orderId = default; + + if (orderId_rawValue != null && System.Guid.TryParse(orderId_rawValue, System.Globalization.CultureInfo.InvariantCulture, out orderId)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var eventStream = await documentSession.Events.FetchForWriting(orderId, httpContext.RequestAborted); + if (eventStream.Aggregate == null) + { + await Microsoft.AspNetCore.Http.Results.NotFound().ExecuteAsync(httpContext); + return; + } + + + // The actual HTTP request handler execution + var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.Ship(command, eventStream.Aggregate); + + eventStream.AppendOne(orderShipped); + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_orders_orderId_ship2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship3.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship3.cs new file mode 100644 index 000000000..bfe1c8da9 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship3.cs @@ -0,0 +1,71 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_orderId_ship3 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_orderId_ship3 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_orderId_ship3(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + string orderId_rawValue = (string?)httpContext.GetRouteValue("orderId"); + System.Guid orderId = default; + + if (orderId_rawValue != null && System.Guid.TryParse(orderId_rawValue, System.Globalization.CultureInfo.InvariantCulture, out orderId)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var eventStream = await documentSession.Events.FetchForWriting(orderId, httpContext.RequestAborted); + if (eventStream.Aggregate == null) + { + await Microsoft.AspNetCore.Http.Results.NotFound().ExecuteAsync(httpContext); + return; + } + + + // The actual HTTP request handler execution + var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.Ship3(eventStream.Aggregate); + + eventStream.AppendOne(orderShipped); + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_orders_orderId_ship3 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship4.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship4.cs new file mode 100644 index 000000000..62c33d789 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship4.cs @@ -0,0 +1,71 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_orderId_ship4 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_orderId_ship4 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_orderId_ship4(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + string orderId_rawValue = (string?)httpContext.GetRouteValue("orderId"); + System.Guid orderId = default; + + if (orderId_rawValue != null && System.Guid.TryParse(orderId_rawValue, System.Globalization.CultureInfo.InvariantCulture, out orderId)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var eventStream = await documentSession.Events.FetchForWriting(orderId, httpContext.RequestAborted); + if (eventStream.Aggregate == null) + { + await Microsoft.AspNetCore.Http.Results.NotFound().ExecuteAsync(httpContext); + return; + } + + + // The actual HTTP request handler execution + var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.Ship4(eventStream.Aggregate); + + eventStream.AppendOne(orderShipped); + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_orders_orderId_ship4 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship.cs new file mode 100644 index 000000000..eed1d4c32 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship.cs @@ -0,0 +1,67 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_ship + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_ship : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_ship(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Reading the request body via JSON deserialization + var (command, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var aggregateId = command.OrderId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, httpContext.RequestAborted).ConfigureAwait(false); + + var problemDetails1 = WolverineWebApi.Marten.CanShipOrderMiddleWare.Before(command, eventStream.Aggregate); + // Evaluate whether the processing should stop if there are any problems + if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) + { + await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.Ship(command, eventStream.Aggregate); + + eventStream.AppendOne(orderShipped); + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_orders_ship + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship_from_query.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship_from_query.cs new file mode 100644 index 000000000..cd7bb225c --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship_from_query.cs @@ -0,0 +1,65 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_orders_ship_from_query + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_orders_ship_from_query : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_orders_ship_from_query(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + string id_rawValue = httpContext.Request.Query["id"]; + System.Guid id = default; + + if (id_rawValue != null && System.Guid.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + var eventStoreOperations = documentSession.Events; + var eventStream = await documentSession.Events.FetchForWriting(id, httpContext.RequestAborted); + if (eventStream.Aggregate == null) + { + await Microsoft.AspNetCore.Http.Results.NotFound().ExecuteAsync(httpContext); + return; + } + + + // The actual HTTP request handler execution + var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.ShipFromQuery(id, eventStream.Aggregate); + + eventStream.AppendOne(orderShipped); + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_orders_ship_from_query + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems.cs new file mode 100644 index 000000000..f5760113b --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems.cs @@ -0,0 +1,51 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_problems + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_problems : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_problems(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var problemDetailsUsageEndpoint = new WolverineWebApi.ProblemDetailsUsageEndpoint(); + // Reading the request body via JSON deserialization + var (message, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var problemDetails1 = problemDetailsUsageEndpoint.Before(message); + // Evaluate whether the processing should stop if there are any problems + if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) + { + await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var result_of_Post = WolverineWebApi.ProblemDetailsUsageEndpoint.Post(message); + + await WriteString(httpContext, result_of_Post); + } + + } + + // END: POST_problems + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems2.cs new file mode 100644 index 000000000..09c3d9dc3 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems2.cs @@ -0,0 +1,51 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_problems2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_problems2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_problems2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (message, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var problemDetails1 = WolverineWebApi.NumberMessageHandler.Validate(message); + // Evaluate whether the processing should stop if there are any problems + if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) + { + await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + WolverineWebApi.NumberMessageHandler.Handle(message); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_problems2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_marten_message.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_marten_message.cs new file mode 100644 index 000000000..088474298 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_marten_message.cs @@ -0,0 +1,61 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_publish_marten_message + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_publish_marten_message : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_publish_marten_message(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + // Reading the request body via JSON deserialization + var (data, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var serviceEndpoints = new WolverineWebApi.ServiceEndpoints(); + + // The actual HTTP request handler execution + await serviceEndpoints.PublishData(data, messageContext, documentSession).ConfigureAwait(false); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_publish_marten_message + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_message1.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_message1.cs new file mode 100644 index 000000000..68e196729 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_message1.cs @@ -0,0 +1,51 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_publish_message1 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_publish_message1 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + + public POST_publish_message1(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + // Reading the request body via JSON deserialization + var (message, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var publishingEndpoint = new Wolverine.Http.Runtime.PublishingEndpoint(); + + // The actual HTTP request handler execution + var result_of_PublishAsync = await publishingEndpoint.PublishAsync(message, messageContext, httpContext.Response); + + await WriteString(httpContext, result_of_PublishAsync); + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_publish_message1 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_question.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_question.cs new file mode 100644 index 000000000..916be62d0 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_question.cs @@ -0,0 +1,43 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_question + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_question : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_question(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (question, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + // Just saying hello in the code! Also testing the usage of attributes to customize endpoints + + // The actual HTTP request handler execution + var arithmeticResults_response = WolverineWebApi.TestEndpoints.PostJson(question); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, arithmeticResults_response); + } + + } + + // END: POST_question + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_reservation.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_reservation.cs new file mode 100644 index 000000000..c155b755e --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_reservation.cs @@ -0,0 +1,66 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_reservation + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_reservation : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_reservation(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (start, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + (var reservationBooked_response, var reservation, var reservationTimeout) = WolverineWebApi.ReservationEndpoint.Post(start); + + + // Register the document operation with the current session + documentSession.Insert(reservation); + + // Outgoing, cascaded message + await messageContext.EnqueueCascadingAsync(reservationTimeout).ConfigureAwait(false); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, reservationBooked_response); + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_reservation + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_always_dead_letter.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_always_dead_letter.cs new file mode 100644 index 000000000..e8bf89104 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_always_dead_letter.cs @@ -0,0 +1,51 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_send_always_dead_letter + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_send_always_dead_letter : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + + public POST_send_always_dead_letter(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + // Reading the request body via JSON deserialization + var (message, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var sendingEndpoint = new Wolverine.Http.Runtime.SendingEndpoint(); + + // The actual HTTP request handler execution + var result_of_SendAsync = await sendingEndpoint.SendAsync(message, messageContext, httpContext.Response); + + await WriteString(httpContext, result_of_SendAsync); + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_send_always_dead_letter + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_message5.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_message5.cs new file mode 100644 index 000000000..0a4c9caf3 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_message5.cs @@ -0,0 +1,51 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_send_message5 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_send_message5 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + + public POST_send_message5(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); + // Reading the request body via JSON deserialization + var (message, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var sendingEndpoint = new Wolverine.Http.Runtime.SendingEndpoint(); + + // The actual HTTP request handler execution + var result_of_SendAsync = await sendingEndpoint.SendAsync(message, messageContext, httpContext.Response); + + await WriteString(httpContext, result_of_SendAsync); + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_send_message5 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_some_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_some_id.cs new file mode 100644 index 000000000..d28c4fc2f --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_some_id.cs @@ -0,0 +1,82 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_some_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_some_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_some_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + // Reading the request body via JSON deserialization + var (request, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var id = (string?)httpContext.GetRouteValue("id"); + if(id == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + var someDocument = await WolverineWebApi.Bugs.SomeEndpoint.LoadAsync(id, documentSession).ConfigureAwait(false); + // 404 if this required object is null + if (someDocument == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var storeDoc = WolverineWebApi.Bugs.SomeEndpoint.Handle(request, someDocument); + + if (storeDoc != null) + { + + // Placed by Wolverine's ISideEffect policy + storeDoc.Execute(documentSession); + + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: POST_some_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn.cs new file mode 100644 index 000000000..8e4f142d5 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_spawn + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_spawn : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + + public POST_spawn(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Reading the request body via JSON deserialization + var (input, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + (var stringValue, var outgoingMessages) = WolverineWebApi.MessageSpawnerEndpoint.Post(input); + + + // Outgoing, cascaded message + await messageContext.EnqueueCascadingAsync(outgoingMessages).ConfigureAwait(false); + + await WriteString(httpContext, stringValue); + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_spawn + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn2.cs new file mode 100644 index 000000000..b435d79a6 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn2.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_spawn2 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_spawn2 : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + + public POST_spawn2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + + // The actual HTTP request handler execution + (var httpMessage1, var httpMessage2) = WolverineWebApi.MessageSpawnerEndpoint.Post(); + + + // Outgoing, cascaded message + await messageContext.EnqueueCascadingAsync(httpMessage1).ConfigureAwait(false); + + + // Outgoing, cascaded message + await messageContext.EnqueueCascadingAsync(httpMessage2).ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + } + + } + + // END: POST_spawn2 + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_status.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_status.cs new file mode 100644 index 000000000..ba6e9e49d --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_status.cs @@ -0,0 +1,44 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Logging; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_status + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_status : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Microsoft.Extensions.Logging.ILogger _loggerForMessage; + + public POST_status(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Microsoft.Extensions.Logging.ILogger loggerForMessage) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _loggerForMessage = loggerForMessage; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (request, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + var result_of_PostStatusCode = WolverineWebApi.StatusCodeEndpoint.PostStatusCode(request, ((Microsoft.Extensions.Logging.ILogger)_loggerForMessage)); + + httpContext.Response.StatusCode = result_of_PostStatusCode; + } + + } + + // END: POST_status + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_things.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_things.cs new file mode 100644 index 000000000..053c32c7e --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_things.cs @@ -0,0 +1,82 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_things + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_things : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public POST_things(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = ((Wolverine.Marten.Publishing.OutboxedSessionFactory)_outboxedSessionFactory).OpenSession(messageContext); + // Catches any existing stream id collision exceptions + try + { + // Reading the request body via JSON deserialization + var (request, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + (var thingCreationResponse_response, var startStream) = WolverineWebApi.Things.ThingEndpoints.CreateThingItem(request); + + if (startStream != null) + { + + // Placed by Wolverine's ISideEffect policy + startStream.Execute(documentSession); + + } + + // This response type customizes the HTTP response + ApplyHttpAware(thingCreationResponse_response, httpContext); + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, thingCreationResponse_response); + } + + + catch(Marten.Exceptions.ExistingStreamIdCollisionException e) + { + await WolverineWebApi.Marten.StreamCollisionExceptionPolicy.RespondWithProblemDetails(e, httpContext); + return; + } + + + } + + } + + // END: POST_things + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_users_sign_up.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_users_sign_up.cs new file mode 100644 index 000000000..433c8f969 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_users_sign_up.cs @@ -0,0 +1,41 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_users_sign_up + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_users_sign_up : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + + public POST_users_sign_up(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (request, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // The actual HTTP request handler execution + var result = WolverineWebApi.SignupEndpoint.SignUp(request); + + await result.ExecuteAsync(httpContext).ConfigureAwait(false); + } + + } + + // END: POST_users_sign_up + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate2_customer.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate2_customer.cs new file mode 100644 index 000000000..43e5d29fd --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate2_customer.cs @@ -0,0 +1,59 @@ +// +#pragma warning disable +using FluentValidation; +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Http.FluentValidation; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_validate2_customer + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_validate2_customer : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly FluentValidation.IValidator _validator; + private readonly Wolverine.Http.FluentValidation.IProblemDetailSource _problemDetailSource; + + public POST_validate2_customer(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, FluentValidation.IValidator validator, Wolverine.Http.FluentValidation.IProblemDetailSource problemDetailSource) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _validator = validator; + _problemDetailSource = problemDetailSource; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (customer, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Execute FluentValidation validators + var result1 = await Wolverine.Http.FluentValidation.Internals.FluentValidationHttpExecutor.ExecuteOne(_validator, _problemDetailSource, customer).ConfigureAwait(false); + + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var result_of_Post = Wolverine.Http.Tests.DifferentAssembly.Validation.Validated2Endpoint.Post(customer); + + await WriteString(httpContext, result_of_Post); + } + + } + + // END: POST_validate2_customer + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_customer.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_customer.cs new file mode 100644 index 000000000..553b60b12 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_customer.cs @@ -0,0 +1,59 @@ +// +#pragma warning disable +using FluentValidation; +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Http.FluentValidation; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_validate_customer + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_validate_customer : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Http.FluentValidation.IProblemDetailSource _problemDetailSource; + private readonly FluentValidation.IValidator _validator; + + public POST_validate_customer(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Http.FluentValidation.IProblemDetailSource problemDetailSource, FluentValidation.IValidator validator) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _problemDetailSource = problemDetailSource; + _validator = validator; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (customer, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + + // Execute FluentValidation validators + var result1 = await Wolverine.Http.FluentValidation.Internals.FluentValidationHttpExecutor.ExecuteOne(_validator, _problemDetailSource, customer).ConfigureAwait(false); + + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var result_of_Post = WolverineWebApi.Validation.CreateCustomerEndpoint.Post(customer); + + await WriteString(httpContext, result_of_Post); + } + + } + + // END: POST_validate_customer + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_user.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_user.cs new file mode 100644 index 000000000..17cde05c0 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_user.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Collections.Generic; +using System.Linq; +using Wolverine.Http; +using Wolverine.Http.FluentValidation; + +namespace Internal.Generated.WolverineHandlers +{ + // START: POST_validate_user + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class POST_validate_user : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly System.Collections.Generic.IEnumerable> _validatorIEnumerable; + private readonly Wolverine.Http.FluentValidation.IProblemDetailSource _problemDetailSource; + + public POST_validate_user(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, System.Collections.Generic.IEnumerable> validatorIEnumerable, Wolverine.Http.FluentValidation.IProblemDetailSource problemDetailSource) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _validatorIEnumerable = validatorIEnumerable; + _problemDetailSource = problemDetailSource; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + // Reading the request body via JSON deserialization + var (user, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var result1 = await Wolverine.Http.FluentValidation.Internals.FluentValidationHttpExecutor.ExecuteMany(_validatorIEnumerable, _problemDetailSource, user).ConfigureAwait(false); + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var result_of_Post = WolverineWebApi.Validation.OtherValidatedEndpoint.Post(user); + + await WriteString(httpContext, result_of_Post); + } + + } + + // END: POST_validate_user + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos2_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos2_id.cs new file mode 100644 index 000000000..0eb9d0147 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos2_id.cs @@ -0,0 +1,82 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: PUT_todos2_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class PUT_todos2_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public PUT_todos2_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + int id = default; + + if (id_rawValue != null && int.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + // Reading the request body via JSON deserialization + var (request, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + (var todo, var result1) = await WolverineWebApi.Samples.Update2Endpoint.LoadAsync(id, request, documentSession).ConfigureAwait(false); + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var todo_response = WolverineWebApi.Samples.Update2Endpoint.Put(id, request, todo, documentSession); + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Writing the response body to JSON because this was the first 'return variable' in the method signature + await WriteJsonAsync(httpContext, todo_response); + } + + } + + // END: PUT_todos2_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos3_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos3_id.cs new file mode 100644 index 000000000..37369d660 --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos3_id.cs @@ -0,0 +1,98 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: PUT_todos3_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class PUT_todos3_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public PUT_todos3_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + int id = default; + + if (id_rawValue != null && int.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + // Reading the request body via JSON deserialization + var (request, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var todo = await WolverineWebApi.Samples.UpdateEndpoint3.LoadAsync(id, documentSession).ConfigureAwait(false); + // 404 if this required object is null + if (todo == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + var result1 = WolverineWebApi.Samples.UpdateEndpoint3.Validate(todo); + // Evaluate whether or not the execution should be stopped based on the IResult value + if (result1 != null && !(result1 is Wolverine.Http.WolverineContinue)) + { + await result1.ExecuteAsync(httpContext).ConfigureAwait(false); + return; + } + + + + // The actual HTTP request handler execution + var storeDoc = WolverineWebApi.Samples.UpdateEndpoint3.Put(id, request, todo); + + if (storeDoc != null) + { + + // Placed by Wolverine's ISideEffect policy + storeDoc.Execute(documentSession); + + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: PUT_todos3_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos_id.cs new file mode 100644 index 000000000..2420545cc --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos_id.cs @@ -0,0 +1,89 @@ +// +#pragma warning disable +using Microsoft.AspNetCore.Routing; +using System; +using System.Linq; +using Wolverine.Http; +using Wolverine.Marten.Publishing; +using Wolverine.Runtime; + +namespace Internal.Generated.WolverineHandlers +{ + // START: PUT_todos_id + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class PUT_todos_id : Wolverine.Http.HttpHandler + { + private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; + private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public PUT_todos_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) + { + _wolverineHttpOptions = wolverineHttpOptions; + _wolverineRuntime = wolverineRuntime; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) + { + var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); + // Building the Marten session + await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); + string id_rawValue = (string?)httpContext.GetRouteValue("id"); + int id = default; + + if (id_rawValue != null && int.TryParse(id_rawValue, System.Globalization.CultureInfo.InvariantCulture, out id)) + { + + } + + else + { + httpContext.Response.StatusCode = 404; + return; + } + + // Reading the request body via JSON deserialization + var (request, jsonContinue) = await ReadJsonAsync(httpContext); + if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; + var todo = await WolverineWebApi.Samples.UpdateEndpoint.LoadAsync(id, documentSession).ConfigureAwait(false); + // 404 if this required object is null + if (todo == null) + { + httpContext.Response.StatusCode = 404; + return; + } + + + // The actual HTTP request handler execution + var storeDoc = WolverineWebApi.Samples.UpdateEndpoint.Put(id, request, todo); + + if (storeDoc != null) + { + + // Placed by Wolverine's ISideEffect policy + storeDoc.Execute(documentSession); + + } + + + // Save all pending changes to this Marten session + await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); + + + // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 + await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); + + // Wolverine automatically sets the status code to 204 for empty responses + if (httpContext.Response is { HasStarted: false, StatusCode: 200 }) httpContext.Response.StatusCode = 204; + } + + } + + // END: PUT_todos_id + + +} + diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/TelegramUpdatedHandler96651444.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/TelegramUpdatedHandler96651444.cs new file mode 100644 index 000000000..b16dfc1ca --- /dev/null +++ b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/TelegramUpdatedHandler96651444.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: TelegramUpdatedHandler96651444 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class TelegramUpdatedHandler96651444 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var telegramUpdated = (WolverineWebApi.Bugs.TelegramUpdated)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "WolverineWebApi.Bugs.TelegramUpdatedHandler"); + + // The actual message execution + WolverineWebApi.Bugs.TelegramUpdatedHandler.Handle(telegramUpdated); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: TelegramUpdatedHandler96651444 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/Event3Handler1940643383.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/Event3Handler1940643383.cs new file mode 100644 index 000000000..79e0ca051 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/Event3Handler1940643383.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: Event3Handler1940643383 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class Event3Handler1940643383 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public Event3Handler1940643383(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var event3 = (MartenTests.AggregateHandlerWorkflow.Event3)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.FooHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = event3.AggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + var outgoing1 = MartenTests.AggregateHandlerWorkflow.FooHandler.Handle(event3, eventStream.Aggregate); + + + // Outgoing, cascaded message + await context.EnqueueCascadingAsync(outgoing1).ConfigureAwait(false); + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: Event3Handler1940643383 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementABHandler294362820.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementABHandler294362820.cs new file mode 100644 index 000000000..f0f32cafb --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementABHandler294362820.cs @@ -0,0 +1,54 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementABHandler294362820 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementABHandler294362820 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementABHandler294362820(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementAB = (MartenTests.AggregateHandlerWorkflow.IncrementAB)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.SpecialLetterHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementAB.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForExclusiveWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + var outgoing1 = MartenTests.AggregateHandlerWorkflow.SpecialLetterHandler.Handle(incrementAB, eventStream.Aggregate); + + if (outgoing1 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing1); + + } + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementABHandler294362820 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementAHandler17491962.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementAHandler17491962.cs new file mode 100644 index 000000000..ac1843b4d --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementAHandler17491962.cs @@ -0,0 +1,48 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementAHandler17491962 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementAHandler17491962 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementAHandler17491962(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementA = (MartenTests.AggregateHandlerWorkflow.IncrementA)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementA.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + var letterAggregateHandler = new MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler(); + + // The actual message execution + var outgoing1 = letterAggregateHandler.Handle(incrementA, eventStream.Aggregate, documentSession); + + eventStream.AppendOne(outgoing1); + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementAHandler17491962 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementBCHandler1271721124.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementBCHandler1271721124.cs new file mode 100644 index 000000000..c7f0e141e --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementBCHandler1271721124.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementBCHandler1271721124 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementBCHandler1271721124 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementBCHandler1271721124(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementBC = (MartenTests.AggregateHandlerWorkflow.IncrementBC)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementBC.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, incrementBC.Version, cancellation).ConfigureAwait(false); + + var letterAggregateHandler = new MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler(); + + // The actual message execution + var outgoing1 = letterAggregateHandler.Handle(incrementBC, eventStream.Aggregate); + + if (outgoing1 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing1); + + } + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementBCHandler1271721124 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementBHandler17491959.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementBHandler17491959.cs new file mode 100644 index 000000000..86e60a5eb --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementBHandler17491959.cs @@ -0,0 +1,51 @@ +// +#pragma warning disable +using Microsoft.Extensions.Logging; +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementBHandler17491959 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementBHandler17491959 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Microsoft.Extensions.Logging.ILogger _logger; + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementBHandler17491959(Microsoft.Extensions.Logging.ILogger logger, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _logger = logger; + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementB = (MartenTests.AggregateHandlerWorkflow.IncrementB)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementB.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + var letterAggregateHandler = new MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler(); + + // The actual message execution + var outgoing1 = await letterAggregateHandler.Handle(incrementB, eventStream.Aggregate, _logger).ConfigureAwait(false); + + eventStream.AppendOne(outgoing1); + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementBHandler17491959 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementCDHandler868436596.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementCDHandler868436596.cs new file mode 100644 index 000000000..adc8533c7 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementCDHandler868436596.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementCDHandler868436596 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementCDHandler868436596 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementCDHandler868436596(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementCD = (MartenTests.AggregateHandlerWorkflow.IncrementCD)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementCD.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, incrementCD.Version, cancellation).ConfigureAwait(false); + + var letterAggregateHandler = new MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler(); + + // The actual message execution + (var outgoing1, var outgoing2) = letterAggregateHandler.Handle(incrementCD, eventStream.Aggregate); + + eventStream.AppendOne(outgoing1); + eventStream.AppendOne(outgoing2); + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementCDHandler868436596 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementCHandler17491960.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementCHandler17491960.cs new file mode 100644 index 000000000..c28fef021 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementCHandler17491960.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementCHandler17491960 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementCHandler17491960 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementCHandler17491960(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementC = (MartenTests.AggregateHandlerWorkflow.IncrementC)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementC.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + var letterAggregateHandler = new MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler(); + + // The actual message execution + letterAggregateHandler.Handle(incrementC, eventStream); + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementCHandler17491960 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementDHandler17491957.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementDHandler17491957.cs new file mode 100644 index 000000000..1cf2d3de9 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementDHandler17491957.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementDHandler17491957 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementDHandler17491957 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementDHandler17491957(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementD = (MartenTests.AggregateHandlerWorkflow.IncrementD)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementD.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + var letterAggregateHandler = new MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler(); + + // The actual message execution + await letterAggregateHandler.Handle(incrementD, eventStream).ConfigureAwait(false); + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementDHandler17491957 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementManyAsyncHandler1215209648.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementManyAsyncHandler1215209648.cs new file mode 100644 index 000000000..8c45e091a --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementManyAsyncHandler1215209648.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementManyAsyncHandler1215209648 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementManyAsyncHandler1215209648 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementManyAsyncHandler1215209648(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementManyAsync = (MartenTests.AggregateHandlerWorkflow.IncrementManyAsync)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementManyAsync.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + var letterAggregateHandler = new MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler(); + + // The actual message execution + var outgoing1 = await letterAggregateHandler.Handle(incrementManyAsync, eventStream.Aggregate, documentSession).ConfigureAwait(false); + + if (outgoing1 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing1); + + } + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementManyAsyncHandler1215209648 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementManyHandler1449869648.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementManyHandler1449869648.cs new file mode 100644 index 000000000..bce36ec8a --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/IncrementManyHandler1449869648.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: IncrementManyHandler1449869648 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class IncrementManyHandler1449869648 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public IncrementManyHandler1449869648(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var incrementMany = (MartenTests.AggregateHandlerWorkflow.IncrementMany)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = incrementMany.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + var letterAggregateHandler = new MartenTests.AggregateHandlerWorkflow.LetterAggregateHandler(); + + // The actual message execution + var outgoing1 = letterAggregateHandler.Handle(incrementMany, eventStream.Aggregate, documentSession); + + if (outgoing1 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing1); + + } + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: IncrementManyHandler1449869648 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/LetterMessage1Handler689109168.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/LetterMessage1Handler689109168.cs new file mode 100644 index 000000000..b69e3541e --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/LetterMessage1Handler689109168.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: LetterMessage1Handler689109168 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class LetterMessage1Handler689109168 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var letterMessage1 = (MartenTests.AggregateHandlerWorkflow.LetterMessage1)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.ResponseHandler"); + + // The actual message execution + MartenTests.AggregateHandlerWorkflow.ResponseHandler.Handle(letterMessage1); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: LetterMessage1Handler689109168 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/LetterMessage2Handler689109169.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/LetterMessage2Handler689109169.cs new file mode 100644 index 000000000..50504fbfb --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/LetterMessage2Handler689109169.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: LetterMessage2Handler689109169 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class LetterMessage2Handler689109169 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var letterMessage2 = (MartenTests.AggregateHandlerWorkflow.LetterMessage2)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.ResponseHandler"); + + // The actual message execution + MartenTests.AggregateHandlerWorkflow.ResponseHandler.Handle(letterMessage2); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: LetterMessage2Handler689109169 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/Outgoing1Handler430475575.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/Outgoing1Handler430475575.cs new file mode 100644 index 000000000..58b169fac --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/Outgoing1Handler430475575.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: Outgoing1Handler430475575 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class Outgoing1Handler430475575 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var outgoing1 = (MartenTests.AggregateHandlerWorkflow.Outgoing1)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.Outgoing1Handler"); + + // The actual message execution + MartenTests.AggregateHandlerWorkflow.Outgoing1Handler.Handle(outgoing1); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: Outgoing1Handler430475575 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseAAAHandler2123707049.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseAAAHandler2123707049.cs new file mode 100644 index 000000000..d59d158c7 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseAAAHandler2123707049.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: RaiseAAAHandler2123707049 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class RaiseAAAHandler2123707049 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public RaiseAAAHandler2123707049(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var raiseAAA = (MartenTests.AggregateHandlerWorkflow.RaiseAAA)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = raiseAAA.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + var outgoing1 = MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler.Handle(raiseAAA, eventStream); + + + // Outgoing, cascaded message + await context.EnqueueCascadingAsync(outgoing1).ConfigureAwait(false); + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: RaiseAAAHandler2123707049 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseAABCCHandler321015832.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseAABCCHandler321015832.cs new file mode 100644 index 000000000..63fd8dd93 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseAABCCHandler321015832.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: RaiseAABCCHandler321015832 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class RaiseAABCCHandler321015832 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public RaiseAABCCHandler321015832(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var raiseAABCC = (MartenTests.AggregateHandlerWorkflow.RaiseAABCC)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = raiseAABCC.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + (var outgoing1, var outgoing2) = MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler.Handle(raiseAABCC, eventStream.Aggregate); + + + // Outgoing, cascaded message + await context.EnqueueCascadingAsync(outgoing1).ConfigureAwait(false); + + if (outgoing2 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing2); + + } + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: RaiseAABCCHandler321015832 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseABCHandler1767975722.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseABCHandler1767975722.cs new file mode 100644 index 000000000..06cc9c9e7 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseABCHandler1767975722.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: RaiseABCHandler1767975722 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class RaiseABCHandler1767975722 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public RaiseABCHandler1767975722(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var raiseABC = (MartenTests.AggregateHandlerWorkflow.RaiseABC)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = raiseABC.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + (var outgoing1, var outgoing2) = MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler.Handle(raiseABC, eventStream.Aggregate); + + if (outgoing1 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing1); + + } + + + // Outgoing, cascaded message + await context.EnqueueCascadingAsync(outgoing2).ConfigureAwait(false); + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: RaiseABCHandler1767975722 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseBBCCCHandler1466785177.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseBBCCCHandler1466785177.cs new file mode 100644 index 000000000..3a374eb63 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseBBCCCHandler1466785177.cs @@ -0,0 +1,62 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: RaiseBBCCCHandler1466785177 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class RaiseBBCCCHandler1466785177 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public RaiseBBCCCHandler1466785177(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var raiseBBCCC = (MartenTests.AggregateHandlerWorkflow.RaiseBBCCC)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = raiseBBCCC.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + (var outgoing1, var outgoing2, var outgoing3) = MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler.Handle(raiseBBCCC, eventStream.Aggregate); + + + // Outgoing, cascaded message + await context.EnqueueCascadingAsync(outgoing1).ConfigureAwait(false); + + if (outgoing2 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing2); + + } + + + // Outgoing, cascaded message + await context.EnqueueCascadingAsync(outgoing3).ConfigureAwait(false); + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: RaiseBBCCCHandler1466785177 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseHandler488373842.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseHandler488373842.cs new file mode 100644 index 000000000..1f94ed669 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseHandler488373842.cs @@ -0,0 +1,60 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: RaiseHandler488373842 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class RaiseHandler488373842 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public RaiseHandler488373842(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var raise = (MartenTests.AggregateHandlerWorkflow.Raise)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = raise.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + (var outgoing1, var outgoing2) = MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler.Handle(raise, eventStream.Aggregate); + + // Wolverine.Marten.UpdatedAggregate generates special response handling + if (outgoing2 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing2); + + } + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + var response_of_letterAggregate = await eventStoreOperations.FetchLatest(aggregateId, cancellation); + + // Outgoing, cascaded message + await context.EnqueueCascadingAsync(response_of_letterAggregate).ConfigureAwait(false); + + } + + } + + // END: RaiseHandler488373842 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseIfValidatedHandler791852127.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseIfValidatedHandler791852127.cs new file mode 100644 index 000000000..f07501a77 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseIfValidatedHandler791852127.cs @@ -0,0 +1,57 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: RaiseIfValidatedHandler791852127 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class RaiseIfValidatedHandler791852127 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public RaiseIfValidatedHandler791852127(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var raiseIfValidated = (MartenTests.AggregateHandlerWorkflow.RaiseIfValidated)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.RaiseIfValidatedHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = raiseIfValidated.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + var result_of_Validate97 = MartenTests.AggregateHandlerWorkflow.RaiseIfValidatedHandler.Validate(eventStream.Aggregate); + // Evaluate whether or not the execution should stop based on the HandlerContinuation value + if (result_of_Validate97 == Wolverine.HandlerContinuation.Stop) return; + + // The actual message execution + var outgoing1 = MartenTests.AggregateHandlerWorkflow.RaiseIfValidatedHandler.Handle(raiseIfValidated, eventStream.Aggregate); + + if (outgoing1 != null) + { + + // Capturing any possible events returned from the command handlers + eventStream.AppendMany(outgoing1); + + } + + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: RaiseIfValidatedHandler791852127 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseLotsAsyncHandler840624058.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseLotsAsyncHandler840624058.cs new file mode 100644 index 000000000..598fc18a8 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseLotsAsyncHandler840624058.cs @@ -0,0 +1,48 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: RaiseLotsAsyncHandler840624058 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class RaiseLotsAsyncHandler840624058 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public RaiseLotsAsyncHandler840624058(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var raiseLotsAsync = (MartenTests.AggregateHandlerWorkflow.RaiseLotsAsync)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = raiseLotsAsync.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + var outgoing1 = MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler.Handle(raiseLotsAsync, eventStream.Aggregate); + + // Apply events to Marten event stream + await foreach (var letterAggregateEvent in outgoing1) eventStream.AppendOne(letterAggregateEvent); + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: RaiseLotsAsyncHandler840624058 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseOnlyDHandler1355962904.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseOnlyDHandler1355962904.cs new file mode 100644 index 000000000..b8b1cee19 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/RaiseOnlyDHandler1355962904.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable +using Wolverine.Marten.Publishing; + +namespace Internal.Generated.WolverineHandlers +{ + // START: RaiseOnlyDHandler1355962904 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class RaiseOnlyDHandler1355962904 : Wolverine.Runtime.Handlers.MessageHandler + { + private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; + + public RaiseOnlyDHandler1355962904(Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) + { + _outboxedSessionFactory = outboxedSessionFactory; + } + + + + public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var raiseOnlyD = (MartenTests.AggregateHandlerWorkflow.RaiseOnlyD)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler"); + await using var documentSession = _outboxedSessionFactory.OpenSession(context); + var eventStoreOperations = documentSession.Events; + var aggregateId = raiseOnlyD.LetterAggregateId; + + // Loading Marten aggregate + var eventStream = await eventStoreOperations.FetchForWriting(aggregateId, cancellation).ConfigureAwait(false); + + + // The actual message execution + var outgoing1 = MartenTests.AggregateHandlerWorkflow.RaiseLetterHandler.Handle(raiseOnlyD, eventStream.Aggregate); + + eventStream.AppendOne(outgoing1); + await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false); + } + + } + + // END: RaiseOnlyDHandler1355962904 + + +} + diff --git a/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/ResponseHandler2029358463.cs b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/ResponseHandler2029358463.cs new file mode 100644 index 000000000..48255f271 --- /dev/null +++ b/src/Persistence/MartenTests/Internal/Generated/WolverineHandlers/ResponseHandler2029358463.cs @@ -0,0 +1,31 @@ +// +#pragma warning disable + +namespace Internal.Generated.WolverineHandlers +{ + // START: ResponseHandler2029358463 + [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")] + public sealed class ResponseHandler2029358463 : Wolverine.Runtime.Handlers.MessageHandler + { + + + public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) + { + // The actual message body + var response = (MartenTests.AggregateHandlerWorkflow.Response)context.Envelope.Message; + + System.Diagnostics.Activity.Current?.SetTag("message.handler", "MartenTests.AggregateHandlerWorkflow.ResponseHandler"); + + // The actual message execution + MartenTests.AggregateHandlerWorkflow.ResponseHandler.Handle(response); + + return System.Threading.Tasks.Task.CompletedTask; + } + + } + + // END: ResponseHandler2029358463 + + +} + diff --git a/src/Wolverine/Wolverine.csproj b/src/Wolverine/Wolverine.csproj index 2874a8bcc..94b4e792a 100644 --- a/src/Wolverine/Wolverine.csproj +++ b/src/Wolverine/Wolverine.csproj @@ -4,7 +4,7 @@ WolverineFx - + diff --git a/wolverine.sln b/wolverine.sln index d1471b7d3..7e3946a23 100644 --- a/wolverine.sln +++ b/wolverine.sln @@ -283,6 +283,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAppWithSQS", "src\Transp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrazyStartingWebApp", "src\Http\CrazyStartingWebApp\CrazyStartingWebApp.csproj", "{4F81953D-5063-44E8-BD65-734C8F41625A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenTarget", "src\Http\CodeGenTarget\CodeGenTarget.csproj", "{C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1589,6 +1591,18 @@ Global {4F81953D-5063-44E8-BD65-734C8F41625A}.Release|x64.Build.0 = Release|Any CPU {4F81953D-5063-44E8-BD65-734C8F41625A}.Release|x86.ActiveCfg = Release|Any CPU {4F81953D-5063-44E8-BD65-734C8F41625A}.Release|x86.Build.0 = Release|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|x64.ActiveCfg = Debug|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|x64.Build.0 = Debug|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|x86.ActiveCfg = Debug|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|x86.Build.0 = Debug|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|Any CPU.Build.0 = Release|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|x64.ActiveCfg = Release|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|x64.Build.0 = Release|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|x86.ActiveCfg = Release|Any CPU + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1719,5 +1733,6 @@ Global {F96DEAFA-C73E-4AF1-A858-E95E9EDB119F} = {7A9E0EAE-9ABF-40F6-9DB9-8FB1243F4210} {692321C4-1A3A-4603-A42F-36B86DC784DA} = {ABE5F332-6709-4EDF-B88A-39DB96542B18} {4F81953D-5063-44E8-BD65-734C8F41625A} = {4B0BC1E5-17F9-4DD0-AC93-DDC522E1BE3C} + {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D} = {4B0BC1E5-17F9-4DD0-AC93-DDC522E1BE3C} EndGlobalSection EndGlobal From 47bfb790b4942b0aa9d6aa1bbda71e4b0fea0aa5 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 16:23:04 -0500 Subject: [PATCH 24/28] Tighter validation on incorrect usages of Saga method signatures. Closes GH-1556 --- .../MartenTests/Saga/not_found_usage.cs | 99 +++++++++++++++++++ src/Wolverine/Persistence/Sagas/SagaChain.cs | 12 +++ .../Runtime/Handlers/HandlerChain.cs | 14 +++ .../Runtime/Handlers/HandlerGraph.cs | 3 + 4 files changed, 128 insertions(+) create mode 100644 src/Persistence/MartenTests/Saga/not_found_usage.cs diff --git a/src/Persistence/MartenTests/Saga/not_found_usage.cs b/src/Persistence/MartenTests/Saga/not_found_usage.cs new file mode 100644 index 000000000..894b7357b --- /dev/null +++ b/src/Persistence/MartenTests/Saga/not_found_usage.cs @@ -0,0 +1,99 @@ +using IntegrationTests; +using JasperFx.Core; +using Marten; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Shouldly; +using Wolverine; +using Wolverine.Marten; +using Wolverine.Persistence.Sagas; +using Wolverine.Tracking; + +namespace MartenTests.Saga; + +public class not_found_usage : IAsyncLifetime +{ + private IHost _host; + + public async Task InitializeAsync() + { + _host = await Host.CreateDefaultBuilder() + .UseWolverine(opts => + { + opts.Services.AddMarten(m => + { + m.DisableNpgsqlLogging = true; + m.Connection(Servers.PostgresConnectionString); + m.DatabaseSchemaName = "invitations"; + }).IntegrateWithWolverine(); + + opts.Policies.AutoApplyTransactions(); + }).StartAsync(); + } + + public async Task DisposeAsync() + { + await _host.StopAsync(); + } + + [Fact] + public async Task try_to_call_handle_on_already_expired_invitation() + { + var id = Guid.NewGuid().ToString(); + + await _host.InvokeMessageAndWaitAsync(new InvitationIssued { Id = id }); + await _host.InvokeMessageAndWaitAsync(new InvitationExpired( id)); + + await using var query = _host.DocumentStore().LightweightSession(); + + // Should be deleted at this point + (await query.LoadAsync(id)).ShouldBeNull(); + + // NotFound should fire here, and no exceptions + await _host.InvokeMessageAndWaitAsync(new InvitationTimeout( id)); + + } +} + +public class InvitationPolicy : Wolverine.Saga +{ + public string Id { get; set; } = null!; + + public static (InvitationPolicy, InvitationTimeout) Start(InvitationIssued message) + { + return (new InvitationPolicy{Id = message.Id}, new InvitationTimeout(message.Id)); + } + + public InvitationExpired Handle(InvitationTimeout message, ILogger logger) + { + logger.LogInformation("Invitation with ID {Id} has timed out", message.Id); + return new InvitationExpired(message.Id); + } + + public void Handle(InvitationExpired message, ILogger logger) + { + logger.LogInformation("Completing saga with id {ID}", message.Id); + MarkCompleted(); + } + + public void Handle(InvitationAccepted message, ILogger logger) + { + logger.LogInformation("Invitation has been accepted. Deleting saga with id {Id}", message.Id); + MarkCompleted(); + } + + public static void NotFound(InvitationTimeout timeout, ILogger logger) + { + logger.LogError("Saga with {Id} has been completed already", timeout.Id); + } +} + +public record InvitationAccepted(string Id); +public record InvitationExpired(string Id); + +public class InvitationIssued +{ + [SagaIdentity] public string Id { get; set; } +}; + +public record InvitationTimeout(string Id) : TimeoutMessage(10.Seconds()); \ No newline at end of file diff --git a/src/Wolverine/Persistence/Sagas/SagaChain.cs b/src/Wolverine/Persistence/Sagas/SagaChain.cs index 7e384483d..b99dea1d4 100644 --- a/src/Wolverine/Persistence/Sagas/SagaChain.cs +++ b/src/Wolverine/Persistence/Sagas/SagaChain.cs @@ -43,6 +43,11 @@ public SagaChain(WolverineOptions options, IGrouping grouping SagaIdMember = DetermineSagaIdMember(MessageType, SagaType); } + protected override void validateAgainstInvalidSagaMethods(IGrouping grouping) + { + // Nothing + } + protected override void tryAssignStickyEndpoints(HandlerCall handlerCall, WolverineOptions options) { // nope, don't do this with saga chains @@ -89,6 +94,13 @@ internal override List DetermineFrames(GenerationRules rules, IServiceCon ExistingCalls = findByNames(Orchestrate, Orchestrates, StartOrHandle, StartsOrHandles, Handle, Handles, Consume, Consumes); + var statics = ExistingCalls.Where(x => x.Method.IsStatic); + if (statics.Any()) + { + throw new InvalidSagaException( + $"It is not legal to use static methods to operate on existing sagas. Use NotFound() for handling non-existent sagas for the identity"); + } + Handlers.Clear(); var list = new List(); diff --git a/src/Wolverine/Runtime/Handlers/HandlerChain.cs b/src/Wolverine/Runtime/Handlers/HandlerChain.cs index 548e154a2..704f15bbd 100644 --- a/src/Wolverine/Runtime/Handlers/HandlerChain.cs +++ b/src/Wolverine/Runtime/Handlers/HandlerChain.cs @@ -15,6 +15,7 @@ using Wolverine.ErrorHandling; using Wolverine.Logging; using Wolverine.Middleware; +using Wolverine.Persistence.Sagas; using Wolverine.Runtime.Routing; using Wolverine.Transports.Local; using Wolverine.Transports.Stub; @@ -83,6 +84,9 @@ internal HandlerChain(MethodCall call, HandlerGraph parent, Endpoint[] endpoints public HandlerChain(WolverineOptions options, IGrouping grouping, HandlerGraph parent) : this( grouping.Key, parent) { + // ReSharper disable once VirtualMemberCallInConstructor + validateAgainstInvalidSagaMethods(grouping); + Handlers.AddRange(grouping); var i = 0; @@ -109,6 +113,16 @@ public HandlerChain(WolverineOptions options, IGrouping group } } + protected virtual void validateAgainstInvalidSagaMethods(IGrouping grouping) + { + var illegalSagas = grouping.Where(x => x.HandlerType.CanBeCastTo() && x.Method.IsStatic).ToArray(); + if (illegalSagas.Any()) + { + throw new InvalidSagaException( + $"Illegal static method {illegalSagas.Select(x => x.ToString()).Join(", ")}. Handler methods for existing saga data mush be instance methods"); + } + } + public IReadOnlyList ByEndpoint => _byEndpoint; internal virtual bool HasDefaultNonStickyHandlers() => Handlers.Any(); diff --git a/src/Wolverine/Runtime/Handlers/HandlerGraph.cs b/src/Wolverine/Runtime/Handlers/HandlerGraph.cs index 11559f9e0..3d95643c9 100644 --- a/src/Wolverine/Runtime/Handlers/HandlerGraph.cs +++ b/src/Wolverine/Runtime/Handlers/HandlerGraph.cs @@ -404,6 +404,9 @@ private bool isSagaMethod(HandlerCall call) { if (call.HandlerType.CanBeCastTo()) { + if (call.Method.Name == SagaChain.NotFound) return true; + + // Legal for Start() methods to be be a static if (!call.Method.IsStatic) return true; if (call.Method.Name.EqualsIgnoreCase("Start")) return true; From b61a646f7a82da4deab8b74f804bf8409384eee2 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 16:28:15 -0500 Subject: [PATCH 25/28] Doc updates about Saga Handle or Start() methods --- docs/guide/durability/sagas.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/guide/durability/sagas.md b/docs/guide/durability/sagas.md index fe9995395..0cb862926 100644 --- a/docs/guide/durability/sagas.md +++ b/docs/guide/durability/sagas.md @@ -1,5 +1,11 @@ # Sagas +::: tip +To be honest, we're just not going to get hung up on "process manager" vs. "saga" here. The key point is that what +Wolverine is calling a "saga" really just means a long running, multi-step process where you need to track some state +between the steps. If that annoys Greg Young, then ¯\_(ツ)_/¯. +::: + As is so common in these docs, I would direct you to this from the old "EIP" book: [Process Manager](http://www.enterpriseintegrationpatterns.com/patterns/messaging/ProcessManager.html). A stateful saga in Wolverine is used to coordinate long running workflows or to break large, logical transactions into a series of smaller steps. A stateful saga in Wolverine consists of a couple parts: @@ -392,7 +398,9 @@ The following method names are meaningful in `Saga` types: | `Orchestrate`, `Orchestrates` | Called only when the identified saga already exists | | `NotFound` | Only called if the identified saga does not already exist, and there is no matching `Start` handler for the incoming message | - +Note that only `Start`, `Starts`, or `NotFound` methods can be static methods because these methods logically assume that the +identified `Saga` does not yet exist. Wolverine as of 4.6 will assert that other named `Saga` methods are instance +methods to try to head off confusion. ## When Sagas are Not Found From c6b2be0c0039f9432116f0d0db044de419d74e9a Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 16:34:59 -0500 Subject: [PATCH 26/28] removed test project that was blowing up in restore --- wolverine.sln | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/wolverine.sln b/wolverine.sln index 7e3946a23..d1471b7d3 100644 --- a/wolverine.sln +++ b/wolverine.sln @@ -283,8 +283,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAppWithSQS", "src\Transp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrazyStartingWebApp", "src\Http\CrazyStartingWebApp\CrazyStartingWebApp.csproj", "{4F81953D-5063-44E8-BD65-734C8F41625A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenTarget", "src\Http\CodeGenTarget\CodeGenTarget.csproj", "{C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1591,18 +1589,6 @@ Global {4F81953D-5063-44E8-BD65-734C8F41625A}.Release|x64.Build.0 = Release|Any CPU {4F81953D-5063-44E8-BD65-734C8F41625A}.Release|x86.ActiveCfg = Release|Any CPU {4F81953D-5063-44E8-BD65-734C8F41625A}.Release|x86.Build.0 = Release|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|x64.ActiveCfg = Debug|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|x64.Build.0 = Debug|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|x86.ActiveCfg = Debug|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Debug|x86.Build.0 = Debug|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|Any CPU.Build.0 = Release|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|x64.ActiveCfg = Release|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|x64.Build.0 = Release|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|x86.ActiveCfg = Release|Any CPU - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1733,6 +1719,5 @@ Global {F96DEAFA-C73E-4AF1-A858-E95E9EDB119F} = {7A9E0EAE-9ABF-40F6-9DB9-8FB1243F4210} {692321C4-1A3A-4603-A42F-36B86DC784DA} = {ABE5F332-6709-4EDF-B88A-39DB96542B18} {4F81953D-5063-44E8-BD65-734C8F41625A} = {4B0BC1E5-17F9-4DD0-AC93-DDC522E1BE3C} - {C38B5CF3-0553-4E9B-8501-5CCC62ADFB1D} = {4B0BC1E5-17F9-4DD0-AC93-DDC522E1BE3C} EndGlobalSection EndGlobal From 06d96b000fad50f9ebab6868d3762057059981f2 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 17:56:35 -0500 Subject: [PATCH 27/28] Doc updates for configuration within Kafka. Closes GH-1554 --- docs/guide/messaging/transports/kafka.md | 4 ++ .../DocumentationSamples.cs | 2 + .../configuration_precedence.cs | 50 +++++++++++++++++++ .../KafkaListenerConfiguration.cs | 3 +- .../Kafka/Wolverine.Kafka/KafkaTopic.cs | 3 +- 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/Transports/Kafka/Wolverine.Kafka.Tests/configuration_precedence.cs diff --git a/docs/guide/messaging/transports/kafka.md b/docs/guide/messaging/transports/kafka.md index dc7911356..e95fb8c1e 100644 --- a/docs/guide/messaging/transports/kafka.md +++ b/docs/guide/messaging/transports/kafka.md @@ -13,6 +13,10 @@ To use [Kafka](https://www.confluent.io/what-is-apache-kafka/) as a messaging tr dotnet add WolverineFx.Kafka ``` +```warning +The configuration in `ConfigureConsumer()` for each topic completely overwrites any previous configuration +``` + To connect to Kafka, use this syntax: diff --git a/src/Transports/Kafka/Wolverine.Kafka.Tests/DocumentationSamples.cs b/src/Transports/Kafka/Wolverine.Kafka.Tests/DocumentationSamples.cs index d7234780b..0868d6bbb 100644 --- a/src/Transports/Kafka/Wolverine.Kafka.Tests/DocumentationSamples.cs +++ b/src/Transports/Kafka/Wolverine.Kafka.Tests/DocumentationSamples.cs @@ -71,6 +71,8 @@ public static async Task configure() // Override the consumer configuration for only this // topic + // This is NOT combinatorial with the ConfigureConsumers() call above + // and completely replaces the parent configuration .ConfigureConsumer(config => { // This will also set the Envelope.GroupId for any diff --git a/src/Transports/Kafka/Wolverine.Kafka.Tests/configuration_precedence.cs b/src/Transports/Kafka/Wolverine.Kafka.Tests/configuration_precedence.cs new file mode 100644 index 000000000..14b7ea71a --- /dev/null +++ b/src/Transports/Kafka/Wolverine.Kafka.Tests/configuration_precedence.cs @@ -0,0 +1,50 @@ +using JasperFx.Core; +using JasperFx.Resources; +using Microsoft.Extensions.Hosting; +using Shouldly; +using Wolverine.Tracking; +using Xunit.Abstractions; + +namespace Wolverine.Kafka.Tests; + +public class configuration_precedence +{ + private readonly ITestOutputHelper _output; + + public configuration_precedence(ITestOutputHelper output) + { + _output = output; + } + + [Fact] + public async Task explicit_configuration_wins() + { + using var host = await Host.CreateDefaultBuilder() + .UseWolverine(opts => + { + opts.UseKafka("localhost:9092").ConfigureConsumers( x => x.GroupId = "Conventional").AutoProvision(); + + opts.ListenToKafkaTopic("General").Named("General"); + + opts.ListenToKafkaTopic("ResponseMessages") + .ConfigureConsumer(x => x.GroupId = "Specific").Named("Specific"); // Not working as expected + + opts.Services.AddResourceSetupOnStartup(); + }).StartAsync(); + + var runtime = host.GetRuntime(); + + foreach (var agent in runtime.Endpoints.ActiveListeners()) + { + _output.WriteLine(agent.Uri.ToString()); + } + + var general = runtime.Endpoints.EndpointFor("kafka://topic/General".ToUri()).ShouldBeOfType(); + general.ConsumerConfig.ShouldBeNull(); + + general.Parent.ConsumerConfig.GroupId.ShouldBe("Conventional"); + + var specific = runtime.Endpoints.EndpointFor("kafka://topic/ResponseMessages".ToUri()).ShouldBeOfType(); + specific.ConsumerConfig.GroupId.ShouldBe("Specific"); + } +} \ No newline at end of file diff --git a/src/Transports/Kafka/Wolverine.Kafka/KafkaListenerConfiguration.cs b/src/Transports/Kafka/Wolverine.Kafka/KafkaListenerConfiguration.cs index c53d9038f..da0b6f603 100644 --- a/src/Transports/Kafka/Wolverine.Kafka/KafkaListenerConfiguration.cs +++ b/src/Transports/Kafka/Wolverine.Kafka/KafkaListenerConfiguration.cs @@ -60,7 +60,8 @@ public KafkaListenerConfiguration ReceiveRawJson(Type messageType, JsonSerialize /// /// Configure the consumer config for only this topic. This overrides the default - /// settings at the transport level + /// settings at the transport level. This is not combinatorial with the parent configuration + /// and overwrites all ConsumerConfig from the parent /// /// /// diff --git a/src/Transports/Kafka/Wolverine.Kafka/KafkaTopic.cs b/src/Transports/Kafka/Wolverine.Kafka/KafkaTopic.cs index 8d665cc8a..4e08cfaa7 100644 --- a/src/Transports/Kafka/Wolverine.Kafka/KafkaTopic.cs +++ b/src/Transports/Kafka/Wolverine.Kafka/KafkaTopic.cs @@ -52,7 +52,8 @@ public static string TopicNameForUri(Uri uri) public override ValueTask BuildListenerAsync(IWolverineRuntime runtime, IReceiver receiver) { - var listener = new KafkaListener(this, ConsumerConfig ?? Parent.ConsumerConfig, + var config = ConsumerConfig ?? Parent.ConsumerConfig; + var listener = new KafkaListener(this, config, Parent.CreateConsumer(ConsumerConfig), receiver, runtime.LoggerFactory.CreateLogger()); return ValueTask.FromResult((IListener)listener); } From 2713a77a0f0fbe1883c75fadd0428417be0d6ffd Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Mon, 21 Jul 2025 19:54:41 -0500 Subject: [PATCH 28/28] bumping to 4.6.0 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0b281bea8..2fd4caee7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ 1570;1571;1572;1573;1574;1587;1591;1701;1702;1711;1735;0618 true enable - 4.5.3 + 4.6.0 $(PackageProjectUrl) true true