Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
luizcarlosfaria authored Jun 3, 2024
1 parent f8fa0d8 commit da37ece
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ builder.Services.MapQueue<BusinessService, BusinessCommandOrEvent>(config => con

#### Scoped and Keyed Services
```cs
builder.Services.AddKeyedScoped<BusinessService>("key-of-service");
// or
builder.Services.AddKeyedScoped("key-of-service", (sp, key) => new BusinessService(... custom dependencies ...));
builder.Services.AddKeyedScoped<BusinessService>("key-of-service-1");
builder.Services.AddKeyedScoped("key-of-service-2", (sp, key) => new BusinessService(... custom dependencies ...));

builder.Services.AddSingleton<IAMQPSerializer, SystemTextJsonAMQPSerializer>();

builder.Services.MapQueue<BusinessService, BusinessCommandOrEvent>(config => config
.WithDispatchInChildScope()
.WithKeyedService("key-of-service")
.WithKeyedService("key-of-service-1") // or "key-of-service-2"
.WithAdapter((svc, msg) => svc.DoSomethingAsync(msg))
.WithQueueName("events")
.WithPrefetchCount(1)
Expand Down

0 comments on commit da37ece

Please sign in to comment.