File tree Expand file tree Collapse file tree 5 files changed +49
-3
lines changed
Wolverine.Http.Tests/Transport Expand file tree Collapse file tree 5 files changed +49
-3
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,8 @@ const config: UserConfig<DefaultTheme.Config> = {
227227 { text : 'Validation' , link : '/guide/http/validation' } ,
228228 { text : 'Fluent Validation' , link : '/guide/http/fluentvalidation' } ,
229229 { text : 'Problem Details' , link : '/guide/http/problemdetails' } ,
230- { text : 'Caching' , link : '/guide/http/caching' }
230+ { text : 'Caching' , link : '/guide/http/caching' } ,
231+ { text : 'HTTP Messaging Transport' , link : '/guide/http/transport' }
231232 ]
232233 } ,
233234 {
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ The functionality is used from extension methods off of the ASP.Net Core [WebApp
4545 app .MapDeleteToWolverine <CustomRequest , CustomResponse >(" /wolverine/request" );
4646 app .MapPutToWolverine <CustomRequest , CustomResponse >(" /wolverine/request" );
4747```
48- <sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Http/WolverineWebApi/Program.cs#L290-L302 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_optimized_mediator_usage ' title =' Start of snippet ' >anchor</a ></sup >
48+ <sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Http/WolverineWebApi/Program.cs#L294-L306 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_optimized_mediator_usage ' title =' Start of snippet ' >anchor</a ></sup >
4949<!-- endSnippet -->
5050
5151With this mechanism, Wolverine is able to optimize the runtime function for Minimal API by eliminating IoC service locations
Original file line number Diff line number Diff line change 1+ # HTTP Messaging Transport
2+
3+ On top of everything else that Wolverine does, the ` WolverineFx.HTTP ` Nuget also contains the ability to use HTTP as a
4+ messaging transport for Wolverine messaging. Assuming you have that library attached to your AspNetCore project, add
5+ this declaration to your ` WebApplication ` in your ` Program.Main() ` method:
6+
7+ <!-- snippet: sample_MapWolverineHttpTransportEndpoints -->
8+ <a id =' snippet-sample_mapwolverinehttptransportendpoints ' ></a >
9+ ``` cs
10+ app .MapWolverineHttpTransportEndpoints ();
11+ ```
12+ <sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Http/WolverineWebApi/Program.cs#L288-L292 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_mapwolverinehttptransportendpoints ' title =' Start of snippet ' >anchor</a ></sup >
13+ <!-- endSnippet -->
14+
15+ The declaration above is actually using Minimal API rather than native Wolverine.HTTP endpoints, but that's perfectly fine
16+ in this case. That declaration also enables you to use Minimal API's Fluent Interface to customize the authorization
17+ rules against the HTTP endpoints for Wolverine messaging.
18+
19+ To establish publishing rules in your application to a remote endpoint in another system, use this syntax:
20+
21+ <!-- snippet: sample_publishing_rules_for_http -->
22+ <a id =' snippet-sample_publishing_rules_for_http ' ></a >
23+ ``` cs
24+ using var host = await Host .CreateDefaultBuilder ()
25+ .UseWolverine (opts =>
26+ {
27+ opts .PublishAllMessages ()
28+ .ToHttpEndpoint (" https://binary.com/api" );
29+ })
30+ .StartAsync ();
31+ ```
32+ <sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Http/Wolverine.Http.Tests/Transport/HttpTransportConfigurationTests.cs#L100-L110 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_publishing_rules_for_http ' title =' Start of snippet ' >anchor</a ></sup >
33+ <!-- endSnippet -->
34+
35+ ::: tip
36+ This functionality if very new, and you may want to reach out through Discord for any questions.
37+ :::
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ public async Task to_http_endpoint_with_cloud_events_sets_serializer_options()
9797 [ Fact ]
9898 public async Task to_http_endpoint_without_cloud_events_keeps_default_options ( )
9999 {
100+ #region sample_publishing_rules_for_http
101+
100102 using var host = await Host . CreateDefaultBuilder ( )
101103 . UseWolverine ( opts =>
102104 {
@@ -105,6 +107,8 @@ public async Task to_http_endpoint_without_cloud_events_keeps_default_options()
105107 } )
106108 . StartAsync ( ) ;
107109
110+ #endregion
111+
108112 var runtime = host . GetRuntime ( ) ;
109113 var transport = runtime . Options . Transports . GetOrCreate < HttpTransport > ( ) ;
110114
Original file line number Diff line number Diff line change @@ -284,9 +284,13 @@ public static async Task<int> Main(string[] args)
284284
285285 #endregion
286286 } ) ;
287-
287+
288+ #region sample_MapWolverineHttpTransportEndpoints
289+
288290 app . MapWolverineHttpTransportEndpoints ( ) ;
289291
292+ #endregion
293+
290294 #region sample_optimized_mediator_usage
291295
292296// Functional equivalent to MapPost(pattern, (command, IMessageBus) => bus.Invoke(command))
You can’t perform that action at this time.
0 commit comments