-
-
Notifications
You must be signed in to change notification settings - Fork 12
Eventing
Nano supports different ways of publishing and subscribing to events.
Adding eventing annotations to model implementations, provides a way of synchronizing entities between applications. Additionally, custom event models can be implemented and published and well as consumed.
Nano registers the interfaces ILogger
and ILogger<T>
during application startup.
The ILoggingProvider
is registered during startup, and the implementing type defines the logging provider used in the application.
The Eventing
section of the configuration defines the behavior of eventing (message queuing) in the application.
The section is serialized into an instance of EventingOptions
, and injected as dependency during startup, thus available for injection throughout the application.
See Appendix - App Settings - Eventing for details about the section and the meaning of the variables.
"Eventing": {
"Host": null,
"VHost": null,
"Port": 5672,
"AuthenticationCredential": {
"Username": null,
"Password": null
},
"UseSsl": false,
"Timeout": 30,
"Heartbeat": 0
}
Nano provides several eventing providers (and more added on request), so usually there is no need to implement a custom data provider for your application.
Eventing providers implements the interface IEventingProvider
. It contains a single method Configure(...)
, that is responsible for handling any configuration and setup required for the eventing provider.
The eventing providers currently supported by Nano, can be referenced in the Appendix - Supported Providers.
The eventing provider must be registered as dependencies.
Invoke the method .AddEventing<TProvider>();
, using the eventing provider implementation as generic type parameters.
.ConfigureServices(x =>
{
x.AddEventing<EasyNetQProvider>();
})
Nano.Eventing.EventingOptions
Nano.Eventing.Interfaces.IEventing
Nano.Eventing.Interfaces.IEventingProvider
Nano.Eventing.Interfaces.IEventingHandler<>
For a full list of supported dependencies, see Appendix: Injected Dependencies.
By default, IEventing
resolves to NullEventing
, which as the name indicates doesn't publish or subscribe to anything. Registering an eventing provider dependency, will override the NullEventing
with the configured eventing provider implementation.