v2.6.0
Pull Requests
- #45 Upgrade xUnit to 2.0.0
- #46 Rework API to better work with async and sync calls
- #50 Upgrade tests to use xUnit 2.0.0
ThrowsAsync
assertions
Issues
- #19 Use counting semaphores instead of thread pools for limiting concurrency
- #30 Move most README contents to wiki page(s)
- #42 Configuration prefixes are inconsistent
- #49 Stack trace information gets lost in fallback re-throw
Notes
All documentation has been moved to the wiki. More detail on the larger changes in this release can be found on #46.
This is a large release, but backwards compatible. SyncCommand
and AsyncCommand
have been introduced as base classes to replace Command
. The original Command
still exists, but has been deprecated and will likely be removed in a future major release.
Highlights of the new SyncCommand
/AsyncCommand
API
- CommandInvoker with Throw/Return variants - To help force the question of "what should happen on failure", invocation happens via an
InvokeThrow
orInvokeReturn
call, with the latter wrapping any exceptions and letting the caller act more decisively in the face of failure. - Improved testability - Testing
Command
behavior with the originalCommand
API was difficult; the newly-introducedICommandInvoker
can be injected for unit testing. - Use semaphore bulkheads (without queues) by default - Thread pools have been replaced by semaphores for lower overhead, dependency reduction, and better
async
support. There are no longer queues in front of the Bulkhead; re-adding them will be assessed for a future release. - Better interface for hooking into metrics -
IMetricEvents
replacesIStats
for a clearer way of hooking into metrics.
Notable differences between new and old Commands
With the two new SyncCommand
and AsyncCommand
base classes, there are some notable differences in behavior to the original Command
base class:
- The
Invoke
INFO log isInvoke
for both sync and async calls (Invoke Command={0} Breaker={1} Pool={2} Timeout={3}
). In the old Command, it'sInvokeAsync
for the async call. - Exceptions aren't wrapped in a
CommandFailedException
. Instead, the root cause exception is simply rethrown with some Command-specific data attached to it. - "Pool" is now "Bulkhead" in a handful of configs, logs, and properties. If porting old Commands over to the new base classes, be sure to duplicate any configured pool values with the appropriate "bulkhead" configuration key.
- New Commands (sync/async) have a timeout configuration key that starts with
mjolnir.command.
The old Commands were inconsistent with the rest of the library and just started withcommand.
. Examples:- Old:
command.my-group.MyCommand.Timeout=1000
- New:
mjolnir.command.my-group.MyCommand.Timeout=1000
- Old:
- New commands default to a 2000ms timeout instead of 15000ms.