diff --git a/src/content/docs/client/mediator/middleware/caching.mdx b/src/content/docs/client/mediator/middleware/caching.mdx index f73df6b..bfee3e1 100644 --- a/src/content/docs/client/mediator/middleware/caching.mdx +++ b/src/content/docs/client/mediator/middleware/caching.mdx @@ -84,4 +84,9 @@ We recommend configuring cache through Microsoft.Extensions.Configuration. Read } } } -``` \ No newline at end of file +``` + +:::danger +Configuration does allow you to specify wildcard/globs `*` to specify all handlers in a namespace use Caching. +WE STRONGLY DISCOURAGE THIS. This feature is something you want to be very explicit about. +::: \ No newline at end of file diff --git a/src/content/docs/client/mediator/middleware/offline.mdx b/src/content/docs/client/mediator/middleware/offline.mdx index 77d3aef..0093f9f 100644 --- a/src/content/docs/client/mediator/middleware/offline.mdx +++ b/src/content/docs/client/mediator/middleware/offline.mdx @@ -30,7 +30,7 @@ Fine grained control over offline data is available via [Request Keys](../reques ```csharp public class MyRequestHandler : IRequestHandler> { - [OfflineAvailable(true)] + [OfflineAvailable] public async Task> Handle(MyRequest request, CancellationToken cancellationToken) { // each return will overwrite the previous return value @@ -44,10 +44,8 @@ Above is configured with the `OfflineAvailableAttribute`. You can also configur ```json { "Mediator": { - "PerformanceLogging": { - "*": { - "ErrorThresholdMilliseconds": 5000 - } + "Offline": { + "MyNamespace.SomeHttpRequest": true } } } @@ -56,6 +54,11 @@ Above is configured with the `OfflineAvailableAttribute`. You can also configur For more info about configuration, see [Middleware Configuration](./) ::: +:::danger +Configuration does allow you to specify wildcard/globs `*` to specify all handlers in a namespace use Offline. +WE STRONGLY DISCOURAGE THIS. This feature is something you want to be very explicit about. +::: + ## Controlling HOW the offline data is stored Often, there are times you want to store data based on the parameter arguments within your request. Trying to build these keys for you diff --git a/src/content/docs/client/mediator/middleware/refresh.mdx b/src/content/docs/client/mediator/middleware/refresh.mdx index eb5d7a9..d2c4d2f 100644 --- a/src/content/docs/client/mediator/middleware/refresh.mdx +++ b/src/content/docs/client/mediator/middleware/refresh.mdx @@ -19,11 +19,28 @@ public class MyStreamRequestHandler : IStreamRequestHandler } ``` -:::note -Refresh timer middleware is installed by the main Shiny.Mediator package by default +## Configuration + +Much like other middleware, you can use the Microsoft.Extensions.Configuration. + +```json +{ + "Mediator": { + "TimerRefresh": { + "MyNamespace.MyStreamHandler": { + "IntervalSeconds": 20 + } + } + } +} +``` + +:::danger +Configuration does allow you to specify wildcard/globs `*` to specify all handlers in a namespace use TimerRefresh. +WE STRONGLY DISCOURAGE THIS. This feature is something you want to be very explicit about. ::: -:::warning -Use this in focused areas without something like cache and offline on top of the request. +:::note +Refresh timer middleware is installed by the main Shiny.Mediator package by default ::: \ No newline at end of file diff --git a/src/content/docs/client/mediator/middleware/replay.mdx b/src/content/docs/client/mediator/middleware/replay.mdx index 3120bd4..d4c5ff1 100644 --- a/src/content/docs/client/mediator/middleware/replay.mdx +++ b/src/content/docs/client/mediator/middleware/replay.mdx @@ -38,18 +38,23 @@ await foreach (var item in stream) ## Configuration +Much like other middleware, you can use the Microsoft.Extensions.Configuration. + ```json { "Mediator": { "ReplayStream": { - "*": { - "AvailableAcrossSessions": true - } + "MyNamespace.MyStreamHandler": true } } } ``` +:::danger +Configuration does allow you to specify wildcard/globs `*` to specify all handlers in a namespace use ReplayStream. +WE STRONGLY DISCOURAGE THIS. This feature is something you want to be very explicit about. +::: + :::note This middleware is installed by default with Shiny.Mediator.Maui or Shiny.Mediator.Blazor ::: \ No newline at end of file diff --git a/src/content/docs/client/mediator/middleware/resilience.mdx b/src/content/docs/client/mediator/middleware/resilience.mdx index fcc1226..380d9d0 100644 --- a/src/content/docs/client/mediator/middleware/resilience.mdx +++ b/src/content/docs/client/mediator/middleware/resilience.mdx @@ -48,4 +48,35 @@ For more documentation on the `Microsoft.Extension.Resilience` library, please s ``` -That's it! Your request handler is now resilient! \ No newline at end of file +That's it! Your request handler is now resilient! + + + +### Configuration + +We recommend configuring cache through Microsoft.Extensions.Configuration. Read [Configuration](./) for more information. + +With the below configuration, you will also not need to configure resilience in your startup code. + +```json +{ + "Mediator": { + "Resilience": { + "My.Namespace.MyHandler": { + "TimeoutMilliseconds": 5000, + "Retry": { + "MaxAttempts": 3, + "UseJitter": true, + "DelayMilliseconds": 3000, + "BackoffType": "Constant" + } + } + } + } +} +``` + +:::danger +Configuration does allow you to specify wildcard/globs `*` to specify all handlers in a namespace use Caching. +WE STRONGLY DISCOURAGE THIS. This feature is something you want to be very explicit about. +::: \ No newline at end of file diff --git a/src/content/docs/release-notes/mediator.mdx b/src/content/docs/release-notes/mediator.mdx index df9d7b0..321e319 100644 --- a/src/content/docs/release-notes/mediator.mdx +++ b/src/content/docs/release-notes/mediator.mdx @@ -15,6 +15,8 @@ import RN from '../../../components/ReleaseNote.astro'; Registration source generator did not default the library namespace Shell and NRE fixes for MAUI Event Collector OpenApiGenerator returns INT by default when no format is supplied +Contract feature attributes have been removed for ReplayStream, Cache, Resilience, & Offline +ReplayStream and Offline are only across sessions now TimedLoggingRequestMiddleware has been renamed to PerformanceLoggingMiddleware (including registration extensions) TimedLoggingAttribute has been removed in favour of ONLY using configuration going forward UserNotifyAttribute has been removed in favour of ONLY using configuration going forward