![]() netstandard2.1 netstandard2.1 was computed. Netstandard2.0 netstandard2.0 is compatible. netcoreapp3.1 netcoreapp3.1 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp2.1 netcoreapp2.1 was computed. Netcoreapp2.0 netcoreapp2.0 was computed. net7.0-windows net7.0-windows was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-android net7.0-android was computed. net6.0-windows net6.0-windows was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-android net6.0-android was computed. net5.0-windows net5.0-windows was computed. Versions Compatible and additional computed target framework versions. ![]() Server publishes an event for the command it processed.Server responds to client with a success message.When the command is successfully consumed.MassTransit moves failed messages to a special _error queue: the audit service consumes these messages and logs them.The retry fails so the server responds with an exception to the client.If it succeeds this time then the normal success procedure is followed. Server will randomly fail to consume a command.Client sends a command to server command queue.Whilst the example is running you can browse to localhost:15672 to see the RabbitMQ management console i.e. Run Run-Example.ps1 to see it working at scale in docker-compose. See example/Example.Client for an example client (of a specific command), server (of that specific command) and auditing microservices. Return await requestClient.Request(command, cancellationToken) Var requestClient = _configuredSendEndpointProvider.GetRequestClient() Public async Task SendSomeCommand(ISomeCommand command, CancellationToken cancellationToken = default) _configuredSendEndpointProvider = configuredSendEndpointProvider Public SomeClient(IConfiguredSendEndpointProvider configuredSendEndpointProvider) Private readonly IConfiguredSendEndpointProvider _configuredSendEndpointProvider Respond to client, preserving correlation ID.Īwait context.RespondAsync(new ) Ĭlients should inject IConfiguredSendEndpointProvider and call GetRequestClient() for request-response or GetSendEndpoint() for fire-and-forget e.g. Public async Task Consume(ConsumeContext context) Registered consumers should inherit IConsumer for example: public class CommandConsumer : IConsumer WithSendEndpointB圜onvention("some_remote_application") The convention is identical to the request-response endpoint above. Setting up an endpoint by convention that supports the fire-and-forget pattern. WithRequestResponseSendEndpointB圜onvention("some_remote_application") The remote application should have a consumer setup with this interface by convention. The convention based endpoint will send commands to some_remote_application_some_other_command. Setting up an endpoint by convention that supports the request-response pattern. Consuming by convention (a queue named some_application_name_some_command) with a single immediate retry. Services.AddMassTransitRabbitMqHostedService("some_application_name", massTransitOptions) ![]() It must be shared with clients wishing to send a command. The application name will be prefixed to all consumer queues. Var massTransitOptions = _configuration.GetMassTransitOptionsConnectionString() You need a RabbitMQ connection string with a amqp scheme for this to work. To use in Startup.cs in ASP.Net Core or IHostBuilder.ConfigureServices in a hosted service application: public IServiceProvider ConfigureServices(IServiceCollection services)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |