/
SendingMessages.cs
35 lines (27 loc) · 999 Bytes
/
SendingMessages.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Wolverine;
using Wolverine.Http;
using WolverineWebApi.Marten;
namespace WolverineWebApi.Samples;
public class SendingMessages
{
public void setup_for_sending()
{
#region sample_send_http_methods_directly_to_Wolverine
var builder = WebApplication.CreateBuilder();
builder.Host.UseWolverine();
var app = builder.Build();
app.MapWolverineEndpoints(opts =>
{
opts.SendMessage<CreateOrder>("/orders/create", chain =>
{
// You can make any necessary metadata configurations exactly
// as you would for Minimal API endpoints with this syntax
// to fine tune OpenAPI generation or security
chain.Metadata.RequireAuthorization();
});
opts.SendMessage<ShipOrder>(HttpMethod.Put, "/orders/ship");
});
// and the rest of your application configuration and bootstrapping
#endregion
}
}