snatch-dev / convey Goto Github PK
View Code? Open in Web Editor NEWA simple recipe for .NET Core microservices.
Home Page: https://convey-stack.github.io
License: MIT License
A simple recipe for .NET Core microservices.
Home Page: https://convey-stack.github.io
License: MIT License
I am getting an error Unable to authenticate using sasl protocol mechanism SCRAM-SHA-1.
when I try to connect to mlab mongo database
QueryDispatcher not working when handler is internal. For CommandHandlers and EventHandlers there are no problem when handlers are internal but when I change queryhandler to internal there the following error occured:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'object' does not contain a definition for 'HandleAsync'
at CallSite.Target(Closure , CallSite , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at Convey.CQRS.Queries.Dispatchers.QueryDispatcher.QueryAsync[TResult](IQuery`1 query)
This seems to be an issue with Visual Studio and .NET Core 3.0 from the other posts that I'm seeing on it. It sounds like it has been resolved in certain versions and then regressed. It comes from calling
AppDomain.CurrentDomain.GetAssemblies()
I've only seen it complain about not being able to load Microsoft.IntelliTrace.Core but other Microsoft assemblies are being reported by others online. Again this runs just fine outside of a test runner but I need to be able to execute my tests. I was trying to follow the pattern used in Pacco.Services.Availability.IntegrationTests.Sync.GetResourceTests. If you just run them as is from the repo you should be able to repro this issue. I tried to fork and apply a potential workaround but am having trouble getting the dependencies to line up somehow. I got past the issue in Convey.CQRS.Commands.Extensions.AddCommandHandlers by forking, filtering the GetAssemblies call to those that contain a parameter for assemblyFilter. I tried the same for Convey.CQRS.Events.Extenstions.AddEventHandlers but I can't even build as the event signature doesn't show up meaning it must be still seeing an old version of that assembly somehow. Maybe from another package's reference. And alternative to supplying an assemblyFilter would be to just filter out the Microsoft assemblies as some are suggesting online as well. I'm just getting a lot of heat for having to comment out my unit tests and was hoping you guys could find a resolution to this. Maybe a more elegant solution would be to infer the namespace of the current app domain and use that to filter rather than having to supply the filter.
Please reply if you aren't able to repro using the Pacco solution test that I referred to as that would indicate that something else is amiss within my local environment.
There are missing CancelletionTokens pameter for queryDispatcher, commandDispatcher and eventDispatcher.
Should I filter programmatically ExcludedPaths in JaegerHttpMiddleware?
Because I can see those paths in Jaeger UI.
When I tried to register swagger is giving me errors
Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator': Failed to compare two elements in the array.) (Error while validating the service descriptor 'ServiceType: Swashbuckle.AspNetCore.SwaggerGen.ISchemaRegistryFactory Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SchemaRegistryFactory': Failed to compare two elements in the array.)'
After update package version to 0.4.342
There is an error in EventHandler.
A circular dependency was detected for the service of type
'Convey.CQRS.Events.IEventHandler<>'. System.Collections.Generic.IEnumerable<Convey.CQRS.Events.IEventHandler<>> -> Convey.CQRS.Events.IEventHandler<>(Convey.Logging.CQRS.Decorators.EventHandlerLoggingDecorator<>) -> Convey.CQRS.Events.IEventHandler<>
When I register an ICommand using UseDispatcherEndpoints I expect that swagger asks me for a JSON with the command. Instead of it, the UI shows me the request like a string field and after I wrote something the field gets cleared.
My Code:
return WebHost.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddConvey()
.AddWebApi()
.AddWebApiSwaggerDocs(options => options
.Enable(true)
.WithName("Order Sample API")
.WithTitle("Order Sample API")
.WithVersion("1"))
.AddCommandHandlers()
.AddQueryHandlers()
.AddInMemoryCommandDispatcher()
.AddInMemoryQueryDispatcher()
.Build();
})
.Configure(app =>
{
app.UseSwaggerDocs()
.UsePublicContracts<Contract>()
.UseDispatcherEndpoints(endpoints => endpoints
.Post<PlaceOrderRequest>("api/Orders")
);
})
.ConfigureLogging((ctx, builder) =>
{
builder.ClearProviders();
if (ctx.HostingEnvironment.IsDevelopment()) builder.AddConsole();
})
.UseSerilog((ctx, builder) => builder.Enrich.FromLogContext()
.ReadFrom.Configuration(ctx.Configuration)
.WriteTo.Async(async => async.Debug())
.WriteTo.Seq("http://localhost:5341"), writeToProviders: true)
.Build().RunAsync();
Shouldn't library projects target .NET Standard for more flexibility in different host projects?
Current option: secretKey
Latest source code option: issuerSigningKey
Please update document.
Dorobicie Event Storming na Eventstore? :)
eventstore.org - wygląda to dobrze ;)
I am currently following your github.io docs on implementing your services and I can't seem to complete the Http setup. UseConsul
in particular. Is there something I am doing incorrectly in my Configure
method?
public void Configure(IApplicationBuilder app,
IHostEnvironment env,
IHostApplicationLifetime applicationLifetime)
{
if (env.IsDevelopment() || env.EnvironmentName == "local")
{
app.UseDeveloperExceptionPage();
}
app
.UseConvey()
[attempting to add .UseConsul() here]
.UseDispatcherEndpoints(endpoints => endpoints
.Get<GetSome, SomeDto>("somes/{someId}")
.Get<BrowseSomes, PagedResult<SomeDto>>("somes"))
.UseSwaggerDocs()
.UseRabbitMq()
.SubscribeCommand<CreateSome>()
.SubscribeCommand<JoinSome>();
}
and I am leveraging the following convey packages:
using Convey;
using Convey.CQRS.Commands;
using Convey.CQRS.Events;
using Convey.CQRS.Queries;
using Convey.Discovery.Consul;
using Convey.Docs.Swagger;
using Convey.LoadBalancing.Fabio;
using Convey.MessageBrokers.CQRS;
using Convey.MessageBrokers.RabbitMQ;
using Convey.Persistence.MongoDB;
using Convey.Persistence.Redis;
using Convey.WebApi;
using Convey.WebApi.CQRS;
using Convey.WebApi.Swagger;
https://convey-stack.github.io/documentation/Web-API/
Docs show an endpoint like this:
.Post<AddParcel>("parcels", (req, ctx) => ctx.Response.Created($"parcels/{req.ParcelId}"))))
And then they show a handler but it doesnt appear that you can get to HttpContext
in a handler.
I hope to see support for more relational databases, such as Postgres, MySQL, MariaDB and Microsoft SQL Server, it would be better if there were related examples
for example if you have more than one role like {"role":["admin","user"]} in your access_token get error in RequestProcessor.cs
System.ArgumentException: An item with the same key has already been added. Key: permissions at System.Collections.Generic.Dictionary
2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable
1 source, Func2 keySelector, Func
2 elementSelector, IEqualityComparer1 comparer) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable
1 source, Func2 keySelector, Func
2 elementSelector)
at Ntrada.Requests.RequestProcessor.ProcessAsync(RouteConfig routeConfig, HttpContext context)
at Ntrada.Handlers.DownstreamHandler.HandleAsync(HttpContext context, RouteConfig config)
at Ntrada.Requests.RequestHandlerManager.HandleAsync(String handler, HttpContext context, RouteConfig routeConfig)
at Ntrada.Routing.RouteProvider.Handle(HttpContext context, RouteConfig routeConfig)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Ntrada.Extensions.Tracing.JaegerHttpMiddleware.Invoke(HttpContext context, ITracer tracer)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Ntrada.Extensions.CustomErrors.ErrorHandlerMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)`
Is there how the ICommandHandler results an object? For example when adding a new user, can I return this user dto?
Hey,
Maybe there should be support for different database types with for example dapper with a generic repository pattern on top.
The exception thrown is:
Unhandled exception. System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000001, 11): Resource temporarily unavailable
at System.Net.Dns.InternalGetHostByName(String hostName)
at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
at System.Net.Sockets.UdpClient.Connect(String hostname, Int32 port)
at Jaeger.Thrift.Senders.Internal.UdpClientAdapter.Connect(String host, Int32 port)
at Jaeger.Thrift.Senders.Internal.ThriftUdpClientTransport..ctor(String host, Int32 port, MemoryStream byteStream, IUdpClient udpClient)
at Jaeger.Thrift.Senders.Internal.ThriftUdpClientTransport..ctor(String host, Int32 port)
at Jaeger.Senders.UdpSender..ctor(String host, Int32 port, Int32 maxPacketSize)
at Convey.Tracing.Jaeger.Extensions.<>c__DisplayClass5_0.<AddJaeger>b__1(IServiceProvider sp)
The line where this occurs is:
I see from your documentation that you support using the standard UseAuthentication
middleware, along with provisioning your own Jwt tokens via Convey.Auth
. I'm not seeing anything in the docs or samples that show how to pull the user identity out of the bearer token sent along with the request.
Your samples shows the CustomerId
being sent in as part of the command. Ideally, I'll pull this information from a claim within the Jwt token. A user can put any customer id they'd want - I need to use a signed token in order to know which user I need to update data on for.
Can you help point me in the right direction on how I would handle this use-case?
First I'm sorry if this isn't the place to ask this question.
And I'm also sorry if this is a dumb question
I have a question as to how some main classes manage the context scope.
I'll take as an example the classes from "CQRS.*.Dispatchers"
Each as this class on the 'publish/send/query' user a code as below
using var scope = _serviceFactory.CreateScope();
var handler = scope.ServiceProvider.GetRequiredService<ICommandHandler<T>>();
await handler.HandleAsync(command);
So my question is in the case of ASP.NET when a request is made, it has its scope.
So let's say we use a CommandHandler to process a request and this command handler also uses an EventDispatcher, i think this is a common example.
With the current code, there is 3 scopes creates individually for Request, CommandHandler and EventHandler?
And each of these scopes would be individual?
If for example we want to use a unique DbContext per request, wouldn't that be a problem?
Hi guys thanks for these really helpfull packages.
Reading your documentation I am trying to implement its contents. I am in
https://convey-stack.github.io/documentation/HTTP/
and I have an issue trying to impement the part of useing consul. It is like that there is not any deffinition of UseConsul.
Need to check that the incoming content type is json and return false if it is not otherwise we cannot add input formatters for other types.
public bool CanRead(InputFormatterContext context)
{
return true;//should be false if not json.
}
Hello, I'm getting a slew of build errors when either building the SLN or any of the sample projects.
This is off the master branch, let me know if you need or information.
Errors are all below with Project(s) and the error.
Assembly 'Convey' with identity 'Convey, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.Extensions.DependencyInjection.Abstractions' with identity 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
Extensions.cs(16, 27): [CS1705] Assembly 'Convey' with identity 'Convey, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.Extensions.Configuration.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.Extensions.Configuration.Abstractions' with identity 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
Extensions.cs(12, 28): [CS0234] The type or namespace name 'Server' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?)
Extensions.cs(14, 27): [CS0012] The type 'IConfiguration' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
EndpointsBuilder.cs(7, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
EndpointsBuilder.cs(8, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
EndpointsBuilder.cs(15, 26): [CS0246] The type or namespace name 'IEndpointRouteBuilder' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(17, 33): [CS0246] The type or namespace name 'IEndpointRouteBuilder' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(23, 56): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(31, 62): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(39, 85): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(47, 57): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(55, 63): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(63, 56): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(71, 62): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(79, 59): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(87, 65): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(95, 58): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(96, 21): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(107, 56): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
EndpointsBuilder.cs(108, 21): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(14, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Extensions.cs(15, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Extensions.cs(16, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Extensions.cs(17, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Extensions.cs(18, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Extensions.cs(43, 23): [CS0246] The type or namespace name 'IApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(43, 61): [CS0246] The type or namespace name 'IApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(53, 84): [CS0246] The type or namespace name 'IMvcCoreBuilder' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(111, 23): [CS0246] The type or namespace name 'IApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(111, 64): [CS0246] The type or namespace name 'IApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(114, 23): [CS0246] The type or namespace name 'IApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(114, 71): [CS0246] The type or namespace name 'IApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(120, 75): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(160, 36): [CS0246] The type or namespace name 'HttpResponse' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(166, 41): [CS0246] The type or namespace name 'HttpResponse' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(182, 42): [CS0246] The type or namespace name 'HttpResponse' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(188, 43): [CS0246] The type or namespace name 'HttpResponse' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(194, 44): [CS0246] The type or namespace name 'HttpResponse' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(200, 42): [CS0246] The type or namespace name 'HttpResponse' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(206, 53): [CS0246] The type or namespace name 'HttpResponse' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(212, 57): [CS0246] The type or namespace name 'HttpResponse' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(219, 59): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(273, 43): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(308, 49): [CS0246] The type or namespace name 'HttpRequest' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(311, 47): [CS0246] The type or namespace name 'HttpRequest' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(314, 40): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
Extensions.cs(317, 38): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
JsonInputFormatter.cs(6, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
JsonInputFormatter.cs(11, 41): [CS0246] The type or namespace name 'IInputFormatter' could not be found (are you missing a using directive or an assembly reference?)
JsonInputFormatter.cs(24, 29): [CS0246] The type or namespace name 'InputFormatterContext' could not be found (are you missing a using directive or an assembly reference?)
JsonInputFormatter.cs(29, 27): [CS0246] The type or namespace name 'InputFormatterResult' could not be found (are you missing a using directive or an assembly reference?)
JsonInputFormatter.cs(29, 59): [CS0246] The type or namespace name 'InputFormatterContext' could not be found (are you missing a using directive or an assembly reference?)
JsonOutputFormatter.cs(2, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
JsonOutputFormatter.cs(8, 42): [CS0246] The type or namespace name 'IOutputFormatter' could not be found (are you missing a using directive or an assembly reference?)
JsonOutputFormatter.cs(17, 36): [CS0246] The type or namespace name 'OutputFormatterCanWriteContext' could not be found (are you missing a using directive or an assembly reference?)
JsonOutputFormatter.cs(22, 38): [CS0246] The type or namespace name 'OutputFormatterWriteContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(3, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
IEndpointsBuilder.cs(9, 49): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(10, 55): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(12, 78): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(15, 50): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(16, 56): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(17, 49): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(18, 55): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(19, 52): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
IEndpointsBuilder.cs(20, 58): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
ErrorHandlerMiddleware.cs(5, 17): [CS0234] The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
ErrorHandlerMiddleware.cs(6, 28): [CS0234] The type or namespace name 'Logging' does not exist in the namespace 'Microsoft.Extensions' (are you missing an assembly reference?)
ErrorHandlerMiddleware.cs(15, 26): [CS0246] The type or namespace name 'RequestDelegate' could not be found (are you missing a using directive or an assembly reference?)
ErrorHandlerMiddleware.cs(17, 26): [CS0246] The type or namespace name 'ILogger<>' could not be found (are you missing a using directive or an assembly reference?)
ErrorHandlerMiddleware.cs(19, 39): [CS0246] The type or namespace name 'RequestDelegate' could not be found (are you missing a using directive or an assembly reference?)
ErrorHandlerMiddleware.cs(20, 13): [CS0246] The type or namespace name 'ILogger<>' could not be found (are you missing a using directive or an assembly reference?)
ErrorHandlerMiddleware.cs(27, 34): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
ErrorHandlerMiddleware.cs(40, 45): [CS0246] The type or namespace name 'HttpContext' could not be found (are you missing a using directive or an assembly reference?)
JsonParser.cs(4, 28): [CS0234] The type or namespace name 'Configuration' does not exist in the namespace 'Microsoft.Extensions' (are you missing an assembly reference?)```
I'm using Convey Discovery. This is my setup
public IServiceProvider ConfigureServices(IServiceCollection services)
{
...
// Add convey consul
services
.AddConvey()
.AddHttpClient()
.AddConsul()
.Build();
and
public void Configure(IApplicationBuilder app, IWebHostEnvironment env,
IApplicationLifetime applicationLifetime,
IStartupInitializer startupInitializer,
ILoggerFactory loggerFactory)
{
...
app.UseConvey();
The sevice is registrated but Consul doen't call to healcheck function.
After latest 0.5.452 outbox stopped working. Message is saved to outbox but is never sent.
Leases have wrong expiration time after renewing.
The problem is here:
public void Refresh(int duration)
{
ExpiryAt = ExpiryAt.AddSeconds(duration);
}
...
lease.Refresh(renewedLease.LeaseDurationSeconds);
When you have lease with ttl 3600 seconds, it cannot go over that.
So when you have for example 10 seconds left and you renew it for another 3600 seconds, the lease expires in the maximum 3600 seconds but in LeaseData
is 3610 seconds.
This causes those leases to expire, because it sends the renew command too late.
Here is my idea to fix this.
First let's change Refresh
to accept double value.
public void Refresh(double duration)
{
ExpiryAt = ExpiryAt.AddSeconds(duration);
}
Then change the renewing loop like this:
var beforeRenew = DateTime.UtcNow;
var renewedLease = await _client.V1.System.RenewLeaseAsync(lease.Id, lease.Duration);
lease.Refresh(renewedLease.LeaseDurationSeconds - (lease.ExpiryAt - beforeRenew).TotalSeconds);
and finally to stabilize the interval, change the delay to:
await Task.Delay(interval.Subtract(DateTime.UtcNow - now), stoppingToken);
I have created some 30 second long leases and ran this for a couple of hours and the difference between Vault's ExpiryAt
and LeaseData.ExpiryAt
was stable 140 ms - LeaseData.ExpiryAt
was 140 ms later.
Any thoughts?
Unhandled exception. System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Convey.MessageBrokers.IBusSubscriber Lifetime: Singleton ImplementationType: Convey.MessageBrokers.RabbitMQ.Subscribers.RabbitMqSubscriber': Unable to resolve service for type 'Microsoft.AspNetCore.Builder.IApplicationBuilder' while attempting to activate 'Convey.MessageBrokers.RabbitMQ.Subscribers.RabbitMqSubscriber'.)
---> System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Convey.MessageBrokers.IBusSubscriber Lifetime: Singleton ImplementationType: Convey.MessageBrokers.RabbitMQ.Subscribers.RabbitMqSubscriber': Unable to resolve service for type 'Microsoft.AspNetCore.Builder.IApplicationBuilder' while attempting to activate 'Convey.MessageBrokers.RabbitMQ.Subscribers.RabbitMqSubscriber'.
---> System.InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Builder.IApplicationBuilder' while attempting to activate 'Convey.MessageBrokers.RabbitMQ.Subscribers.RabbitMqSubscriber'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(ServiceDescriptor serviceDescriptor, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable1 serviceDescriptors, ServiceProviderOptions options) --- End of inner exception stack trace --- at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable
1 serviceDescriptors, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder)
at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
I'm trying to add OutBox packages for using with EF, but it seems that the required package is not published in nuget.org.
As we all know that gRPC is shipped with .NET Core 3.0. If we want to use gRPC with Convey stack so how can we handle the routing according to with .NET Core 3 routing which integrates with gRPC service?
Do we have any plan for it?
Vault package does not have implemented getting new lease credentials after max_ttl expires.
It renews that lease until the max_ttl and then app becomes broken.
You currently have to restart your app every [max_ttl] so it can get new credentials.
With this update also other packages must be updated to use transient or scoped lifetime instead of singleton (MongoDB uses singleton and I think RabbitMQ too, don't know about the others).
Hello,
I have a problem with an invocation of simple IRequestHandler. The handler will never get invoked.
public class Program
{
public static async Task Main(string[] args)
{
await WebHost
.CreateDefaultBuilder(args)
.ConfigureServices(services => services
.AddConvey()
.AddWebApi()
.Build())
.Configure(app => app
.UseEndpoints(endpoints => endpoints
.Get("", ctx => ctx.Response.WriteJsonAsync(ctx.RequestServices.GetService<AppOptions>() ) )
.Delete<DeleteParcel>("parcels/{parcelId}")))
.UseLogging()
.Build()
.RunAsync();
}
}
public class DeleteParcel : IRequest
{
public int ParcelId { get; }
public DeleteParcel(int parcelId)
{
ParcelId = parcelId;
}
}
public class DeleteParcelHandler : IRequestHandler<DeleteParcel, int>
{
public async Task<int> HandleAsync(DeleteParcel request)
{
return request.ParcelId;
}
}
I was wondering is there any idea to be able to hook into ASP.NET Core's auth system when defining these?
Please use something similar to following instructions:
var eventType = @event.GetType();
var handlerType = typeof(IEventHandler<>).MakeGenericType(eventType);
using var scope = _serviceFactory.CreateScope();
dynamic handlers = scope.ServiceProvider.GetServices(handlerType);
foreach (var handler in handlers)
{
if (handler == null)
return;
await handler.HandleAsync((dynamic) @event);
}
Hi.
There is a small issue with creating queue in RabbitMqSubscriber. When logger in config file is set to false (or is not specified as it was in my case) new queue will not be created.
Probably changing order of if statement do the trick.
I have an API layer that I want to call multiple different services with Fabio and to do that I want to spin up a few Service clients. It looks like there is no way to do that currently? I remember there being a way to register multiple service forwarders in some of the DNC DShop examples.
Is there a plan to migrate OpenTracing to OpenTelemetry once it's mature enough?t OpenTracing and OpenCensus are merging into OpenTelemetry (https://medium.com/opentracing/merging-opentracing-and-opencensus-f0fe9c7ca6f0), so the existing projects will no longer be maintained & supported:
opentracing-contrib/csharp-netcore#45
https://github.com/open-telemetry/opentelemetry-dotnet
It appears like there will be native support for Jaeger too, but from what I can see the development is moving fast, and there is probably a number of breaking changes at the moment.
Hi,
Would you consider removing reference to Newtonsoft.Json and replace it with System.Text.Json?
It's already removed from ASP.NET.Core and its default library for serialization in .Net 5.
I know it is possible to override it with AddWebApi extension method, but the default is still Newtonsoft.Json and in other parts (like RabbitMQ) it is impossible to do.
My proposition is to change all parts of Covey to use System.Text.Json and expose easy to use method to change it for Newtonsoft.Json (for instance using Microsoft.AspNetCore.Mvc.NewtonsoftJson)
InboxMessages are not saving in EF when recieveing events and outbox is enabled and decorator added
Very nice library !
What's the easiest way to use this library with azure service bus instead of rabbitmq?
Software evolves, there is progressive insight and as a result commands, queries, domain events and integration events need updating which usually means versioning.
This is an often underestimated pain point.
(See e.g. https://leanpub.com/esversioning)
Ideas?
Btw, very interesting project !
Was wondering if there was any plans to support multiple port registration for consul via appsettings file. Implementing gRPC into a demo app, and i would love to be able to utilize the consul service discovery for it as well, but without a httpclient. I cant access the ConsulService class, as it is internal sealed, and without the ability to register multiple ports to the Consul service, i would have to choose purely http or gRPC.
Currently there are some swagger generation issues when using 'dispatcher endpoints'.
Using the endpoints from Pacco.Vehicles I have stumbled upon the following:
when endpoints with the same path exist, only the first one with particular path will be added to the swagger document
e.g.: .Get<GetVehicle, VehicleDto>("vehicles/{vehicleId}") and .Put<UpdateVehicle>("vehicles/{vehicleId}")
will result in only the GET endpoint being added in the swagger document.
example models are currently not rendered as seen here:
At first glance these problems occur in the WebApiDocumentFilter class.
I can post a repro if needed.
Hi,
I need o get the current login user-id from authentication service while in order service to set order record created by id?
Thanks in advance
Sending a GET request to the Web API with an array of parameters, e.g .:
GET {{url}}/check?archival=1&ids[0].type=gitid&ids[0].value=123456&ids[1].type=shortid&ids[1].value=d4a
The archival
parameter is inserted into the object, the ids
list is not.
Query object class looks like this:
public class CheckIdentifiers : IQuery<CheckIdentifiersDto>
{
public IList<Identifier> Ids { get; set; }
public bool Archival { get; set; }
}
public class Identifier
{
public string Type { get; set; }
public string Value { get; set; }
}
Hi guys
I found an issue using vs2019
I saw that AllowSynchronousIO is set only for Kestrel and since VS2019 uses also IISExpress maybe adding the same for IISServerOptions could be helpful.
I wanted to send you a MR but strange errors happened with my git 🔢
Awesome work guys !! 💪
Congrats
If I wanted to contribute and create a new Convey
feature that may compete with the current implemented features, would you prefer I fork/branch/PR here, or publish my own custom integration?
Example: I want to use Convey
, but instead of using the current CQRS solution I'd like to use a MediatR
-based solution and create a routing facade very similar to Convey.WebApi.CQRS
. Do you have any guidance as to where should I author such an extension to your platform?
For the record, I don't dislike your CQRS implementation, but MediatR
does offer some enhanced functionality such as Pipeline behaviors that potentially provide significant value.
Hello, I have local MongoDB and with the newest Convey update, where you set minimum MongoDB Driver to 2.11.2 I am getting an exception:
[12:41:03 ERR] Standalone servers do not support transactions.
System.NotSupportedException: Standalone servers do not support transactions.
at MongoDB.Driver.Core.Bindings.CoreSession.EnsureTransactionsAreSupported()
at MongoDB.Driver.Core.Bindings.CoreSession.EnsureStartTransactionCanBeCalled()
at MongoDB.Driver.Core.Bindings.CoreSession.StartTransaction(TransactionOptions transactionOptions)
at MongoDB.Driver.Core.Bindings.WrappingCoreSession.StartTransaction(TransactionOptions transactionOptions)
at MongoDB.Driver.Core.Bindings.WrappingCoreSession.StartTransaction(TransactionOptions transactionOptions)
at MongoDB.Driver.ClientSessionHandle.StartTransaction(TransactionOptions transactionOptions)
at Convey.MessageBrokers.Outbox.Mongo.Internals.MongoMessageOutbox.HandleAsync(String messageId, Func`1 handler)
at Convey.Logging.CQRS.Decorators.CommandHandlerLoggingDecorator`1.HandleAsync(TCommand command)
at Convey.CQRS.Commands.Dispatchers.CommandDispatcher.SendAsync[T](T command)
at Convey.WebApi.CQRS.Builders.DispatcherEndpointsBuilder.BuildCommandContext[T](T command, HttpContext context, Func`3 beforeDispatch, Func`3 afterDispatch)
at Convey.WebApi.EndpointsBuilder.BuildRequestContext[T](HttpContext httpContext, Func`3 context, Action`1 endpoint)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.ApdexMiddleware.Invoke(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.PerRequestTimerMiddleware.Invoke(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.RequestTimerMiddleware.Invoke(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.ErrorRequestMeterMiddleware.Invoke(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.ActiveRequestCounterEndpointMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Convey.WebApi.Exceptions.ErrorHandlerMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
I tried to downgrade Convey back to 0.4.354 and installed MongoDB Driver 2.10.4 and everything works again.
This is happening with every 2.11.* release.
Maybe I have something misconfigured somewhere, but since it works with older version, I'm not sure about that.
Could you include an implementation a of an HttpClient that will support XML serialization?
UseSwaggerDocs()
When added in program.cs -< Configure, throws exception at runtime as below.
at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.WebHost[6]
Application startup exception
System.NullReferenceException: Object reference not set to an instance of an object.
at Convey.Docs.Swagger.Extensions.UseSwaggerDocs(IApplicationBuilder builder)
at sphere.api.Program.<>c.b__1_1(IApplicationBuilder app)
I'm sending a GET request to the Web API. If the first character in the value string is any of:
[{"
The query fails. Sample strings causing the problem:
asd"asd
[test
{asd
I get the error:
[21:42:40 ERR] Unexpected character encountered while parsing value: [. Path 'name', line 1, position 35.
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path 'name', line 1, position 35.
at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
at Newtonsoft.Json.JsonTextReader.ReadAsString()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Open.Serialization.Json.Newtonsoft.JsonSerializerInternal.Deserialize[T](String value)
at Convey.WebApi.Extensions.ReadQuery[T](HttpContext context)
at Convey.WebApi.EndpointsBuilder.BuildQueryContext[T](HttpContext httpContext, Func3 context, Action
1 endpoint)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Convey.WebApi.Exceptions.ErrorHandlerMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
There seems to be something wrong with replace here:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.