skip to content

After MediatR moved to Lucky Penny's RPL-1.5-or-commercial licence, how would you decide whether a portfolio of ASP.NET Core services licenses it or replaces it?

level: principalimportance: should knowfreq 30%

answer

  1. RPL 1.5 or the paid agreement
  2. enforcement is a log line
  3. inventory: Send, Publish, behaviours, streams
  4. ISender is the seam to swap
  5. endpoint filters for cross-cutting

basics

~20 s

Treat it as a licensing decision, not a code fix: MediatR 14 ships under RPL 1.5 or a paid Lucky Penny licence and only logs licence problems. Inventory what each service uses, then weigh licence cost against replacement effort.

solid answer

~50 s

Start with the facts: MediatR 14's `LICENSE.md` offers RPL 1.5, whose reciprocal terms bite if you do not want to release your own source, or Lucky Penny's paid agreement, and the code enforces nothing beyond log entries, so 'it still runs' is not an answer. Then inventory per service: services that only `Send` a request to one handler are cheap to move to injected handler classes or a tiny in-house dispatcher; services leaning on notifications, open behaviours, exception handlers and streams are expensive. Price the licence for the portfolio against that migration, plus testing and retraining. Licensing is usually right for many services with heavy pipeline use; replacement suits a few thin services. Either way, depend on `ISender` and your own message types, keep cross-cutting concerns where ASP.NET Core already offers them (endpoint filters, middleware), and get licence terms reviewed by legal, not by engineers.

go deeper

for a junior

Recall that MediatR 14 is offered under RPL 1.5 or a paid Lucky Penny licence, and that the absence of errors does not mean a service is licensed.

for a middle

Explain which MediatR features a service uses and how each would be replaced, from injected handlers to endpoint filters and explicit notification calls.

for a senior

Estimate migration cost per service from handler and behaviour counts, and design new code so the mediator stays behind ISender or a thin interface.

for a principal

Own the portfolio decision: weigh licence cost, legal review of reciprocity, migration risk and maintenance of an in-house dispatcher, and decide per service with a review date.

## The facts the decision rests on Before any opinion, establish what is true for the version you run. - **The licence.** MediatR 14's `LICENSE.md` says the code is governed by the **Reciprocal Public License 1.5**, and that if you do not wish to release the source of software you build with it under those terms, you may use it under Lucky Penny Software's licence agreement instead. What RPL reciprocity requires of your services is a question for legal counsel, not for this review. - **The enforcement.** MediatR validates the key offline and only **logs**: a warning with no key, errors for an expired or wrong-product key. Nothing is disabled. Technical success therefore proves nothing about compliance. - **The surface.** MediatR is a small library: two dispatch shapes, a stream shape, pipeline behaviours, processors and exception handlers. The replacement cost depends on how much of that you actually use. ## Inventory what each service uses | Feature in use | What replacing it means | Relative cost | |---|---|---| | `Send` to one handler per request | inject the handler class (or a small `ISender`-like interface) into the endpoint | low | | `IPipelineBehavior` for logging, validation, transactions | endpoint filters, middleware, or decorators (for example Scrutor's `Decorate`) | medium | | `Publish` with several handlers | an explicit list of reactions, or `IEnumerable<IOrderPlacedReaction>` from DI | medium | | Exception handlers and actions, processors | re-create each as a filter or decorator | medium to high | | `CreateStream` with stream behaviours | return `IAsyncEnumerable<T>` from a service | low to medium | | `Send(object)` dynamic dispatch | your own reflection-based dispatcher | high | Count services, handlers per service, and behaviours. A thin service with 15 handlers and no behaviours is a day's work; a service with 300 handlers, five open behaviours and notification fan-out is a project. ## The options 1. **License the portfolio.** Lowest engineering cost and no behavioural risk. Costs money every term, and adds an operational duty: keys in a secret store, expiry tracked, alerts on the licence log category. 2. **Replace in thin services, license the rest.** Often the pragmatic middle; it shrinks the licensed footprint without a risky rewrite of the pipeline-heavy services. 3. **Replace everywhere.** Removes the dependency and its licence question, at the price of migration, regression risk and owning a dispatcher you now maintain. 4. **Stay on a release you already use.** Only if that release's own licence file permits your use (read it, do not assume), and it means forgoing fixes, so it is a holding pattern, not a strategy. Ignoring the question and filtering the warning is not an option on this list. ## What not to do - **Do not let the log filter make the decision.** Setting `LuckyPennySoftware.MediatR.License` to `None` in production hides the only evidence that a service runs unlicensed. - **Do not rewrite under deadline.** A big-bang replacement of behaviours and notifications across many services is where regressions hide; migrate one thin service first and measure the effort. - **Do not build a clone of MediatR in-house by accident.** If the replacement grows behaviours, processors, exception handlers and dynamic dispatch, you now maintain a mediator library without its tests; at that point licensing was probably cheaper. - **Do not decide on licence cost alone.** Retraining, documentation and the review burden of a home-grown dispatcher are real costs too. ## Keeping the switch cheap - Endpoints depend on **`ISender`** or a thin interface of your own, never on `Mediator`. - Request and handler types carry no MediatR-specific logic beyond the marker interface, so they can be re-pointed. - Cross-cutting concerns already supported by ASP.NET Core (endpoint filters, middleware, `IExceptionHandler`) live there rather than in behaviours, unless the behaviour must also run outside HTTP. ## How to decide 1. Inventory features and handler counts per service. 2. Get the licence terms and price reviewed for the portfolio. 3. Estimate migration per service, including tests. 4. Decide per service, not per company, and record the reasoning with a review date tied to the licence renewal. There is no universally right answer: a portfolio whose architecture leans on pipeline behaviours usually pays; a handful of CRUD services that only `Send` usually do not need a mediator library at all.

  • The services run fine without a key. Why is that not the end of the discussion?
    Because MediatR 14 enforces its licence only through log entries: no key gives a warning that explicitly says production requires a licensed version. Working code proves nothing about compliance; the terms in `LICENSE.md` (RPL 1.5 or the paid agreement) apply regardless, and silencing the log category just removes the evidence.
  • What makes a later swap away from MediatR cheap or expensive?
    Cheap: endpoints depend on `ISender` or your own interface, handlers are plain classes with constructor injection, and cross-cutting concerns sit in endpoint filters or middleware. Expensive: `IMediator` injected everywhere, notification fan-out with implicit ordering, open behaviours and exception handlers carrying business rules, and `Send(object)` dynamic dispatch.

  • MediatR still works without a key, so production needs no licence.
  • Filtering the licence warning settles the licensing question.
  • Replacing MediatR is always a quick find-and-replace job.
  • The decision must be the same for every service in the portfolio.

Assumes MediatR 14.2, whose LICENSE.md offers RPL 1.5 or the Lucky Penny licence agreement and whose code only logs licence problems.