Comments (3)
It is already possible to use IHostApplicationLifetime
methods from your critical error action. For example, here's one way you can do that:
var builder = Host.CreateApplicationBuilder(args);
IHostApplicationLifetime lifetime = null;
var endpointConfiguration = new EndpointConfiguration("example");
var routing = endpointConfiguration.UseTransport(new LearningTransport());
endpointConfiguration.UseSerialization<SystemJsonSerializer>();
endpointConfiguration.DefineCriticalErrorAction((context, cancellationToken) => OnCriticalError(context, cancellationToken, lifetime));
builder.UseNServiceBus(endpointConfiguration);
var app = builder.Build();
lifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
app.Run();
static Task OnCriticalError(ICriticalErrorContext context, CancellationToken cancellationToken, IHostApplicationLifetime lifetime)
{
lifetime.StopApplication();
return Task.CompletedTask;
}
from nservicebus.
We have an application portfolio spanning 150 repos containing deployable code; mixture of ASP.NET and Windows Services. In order to keep this maintainable and consistent, we have created a highly opinionated framework on top of ASP.NET. This sets up authentication, logging, metrics, and a bunch of other things. When using external libraries such as NServiceBus, Quartz or GraphQL, we wrap them in a system that allows us to easily set them up with the rest of the system.
Your example takes advantage of C# closures and the fact that everything is in the same file. This is not something our applications can take advantage.
from nservicebus.
Hi @dnv-kimbell
Thanks for providing more context to this feature request.
We acknowledge that, currently, the API is not ideal for your scenario.
We will take this into consideration in an upcoming enhancement release.
Regards
John
from nservicebus.
Related Issues (20)
- Remove polyfil dependencies HOT 3
- For OpenTelemetry metrics, allow Func<string, string> to be specified to trim the enclosed message types tag HOT 6
- Saga and outbox persistence that uses Entity Framework
- Overriding the host name does not work consistently
- AssemblyScanner finds private classes HOT 1
- Obsolete NServiceBus.Logging
- Support for Azure Event Hubs (Kafka) HOT 1
- Support for Azure Event Grid (MQTT)
- Messages cannot be sent from Windows to Linux using the file share data bus HOT 1
- Providing an empty license string throws an exception HOT 3
- Creating an endpoint and not referencing the instance results in memory/resource leak HOT 1
- Add tests for scenarios without `InstallersEnabled`
- Allow user to define the scope of a trace HOT 1
- Dispatch binary messages in incoming message context via `ReadOnlyMemory<Char>` or `Stream`
- Register multiple serializers for outgoing messages
- Customizable envelope formatting (Integration, standardization, interop)
- Make it easier to use the hosting builder from Microsoft.Extensions.Hosting
- `IMessageSerializer` is not registered in DI and cannot be injected when replacing `SerializeMessageConnector`
- OpenTelemetry Metrics: Emit an UpDownCounter (gauge) for active handlers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nservicebus.