Replies: 6 comments 11 replies
-
Also, will include the serialization rewrite: #2727 |
Beta Was this translation helpful? Give feedback.
-
Please keep NewId as a separate package, I'm using it for projects without MassTransit |
Beta Was this translation helpful? Give feedback.
-
Hi Chris. Regarding third-party containers, e.g. Autofac: it supports tagged lifetime scopes and nested containers (registration overrides). First one might not be a big issue, but nested containers could be a problem. Could you suggest how to implement this using MS DI in MT8? Thanks |
Beta Was this translation helpful? Give feedback.
-
Is there a planned released date for MT8? |
Beta Was this translation helpful? Give feedback.
-
Hi @phatboyg, |
Beta Was this translation helpful? Give feedback.
-
I have updated to Version 8. Removed .AspNetCore project. So Generic Request Client is now automatically registered? |
Beta Was this translation helpful? Give feedback.
-
MassTransit v8 will be the first major release since the availability of .NET 6. MassTransit v8 works a significant portion of the underlying components into a more manageable solution structure. Focused on the developer experience, while maintaining compatibility with previous versions, this release brings together the entire MassTransit stack.
Consolidation
Automatonymous, Green Pipes, and NewId have been integrated into a single MassTransit solution. This brings the core functionality of MassTransit into a single namespace. This makes it easier to find the right interface, extension method, or component needed. Many new MassTransit developers struggle with missing
using
statements and with this change that should no longer be an issue. For the most part the entire developer surface area exists within theMassTransit
namespace, requiring only:using MassTransit;
Configuration
While the core MassTransit components can be used on their own, without a container, the vast majority of users configure MassTransit using the
AddMassTransit
extension method. And without prompting, they most commonly don't see to also configure the hosted service usingAddMassTransitHostedService
. With v8,Microsoft.Extensions.Hosting.Abstractions
is now included, and the hosted service is registered by default. This means no more separate call toAddMassTransitHostedService
and no dependency onMassTransit.AspNetCore
.The hosted service can also be configured using the standard Microsoft configuration extensions. For instance, all of the following options are optional, but can be configured.
Containers
MassTransit is now using Microsoft.Extensions.DependencyInjection.Abstractions as the standard dependency injection mechanism. This means that all configuration (such as
AddMassTransit
,AddMediator
) is built againstIServiceCollection
.MassTransit registrations (consumers, sagas, activities, futures, as well as endpoints) are now managed completely inside the container, allowing developers to create their own discovery/configuration constructs while still being able to use the
AddMassTransit/UsingXxxx
syntax.Third Party Containers
Support for other containers, such as AutoFac, Simple Injector, StructureMap, and Castle Windsor will no longer be provided. For those containers, if they support configuration via
IServiceCollection
and provide anIServiceProvider
implementation, they can be used with MassTransit (exactly the same as if they were being used with ASP.NET Core).For example, Autofac provides an integration package resulting in code similar to what is shown below:
In this example, some components are registered via Autofac (the consumer dependency), and the MassTransit configuration is used to add consumers, configure the bus, etc.
Unit Testing
With the container integration mentioned above, it's important to refresh how unit tests are created to simplify the creation of tests using the container. As such, an initial example of a new unit test is shown below. The final syntax is still being tweaked with the goal to make it easy to test consumers, sagas, state machines (including custom state machine activities), and routing slip activities.
To be continued...
Beta Was this translation helpful? Give feedback.
All reactions