← Obvs

Release notes

What's new in v7

v7 makes Obvs a library you host, test and observe the way you do the rest of a modern .NET app. The Rx streams that were v6's whole API are still there, and v6 and v7 apps work together on the same broker, so you can move one app at a time.

Highlights

Before and after

Configuring the bus:

v6
IServiceBus bus = ServiceBus.Configure()
    .WithRabbitMQEndpoints<IOrderMessage>()
        .Named("orders")
        .ConnectToBroker("amqp://localhost:5672")
        .SerializedAsJson()
        .AsClientAndServer()
    .UsingConsoleLogging()
    .Create();
v7
builder.Services.AddObvs(obvs => obvs
    .AddService<IOrderMessage>("orders", service => service
        .UseRabbitMq(options => options.Uri = new Uri("amqp://localhost:5672"))));

// IServiceBus and IServiceBusClient are in the container. The bus starts with the host.

Handling a command:

v6
bus.Commands.OfType<PlaceOrder>().Subscribe(async command =>
{
    await bus.PublishAsync(new OrderPlaced(command.OrderId));
});
v7
service.HandleCommand<PlaceOrder>(async (command, context, ct) =>
{
    await context.PublishAsync(new OrderPlaced(command.OrderId), ct);
});

// Or a class from the container
service.HandleCommand<PlaceOrder, PlaceOrderHandler>();

Making a request. The v6 way still works in v7, and a request that names its response, as GetQuote : IRequest<Quote> does, can be awaited:

v6 and v7
var quote = await bus.GetResponses(new GetQuote("sku-1"))
    .OfType<Quote>().Take(1).Timeout(TimeSpan.FromSeconds(5)).ToTask();
v7
var quote = await client.RequestAsync(
    new GetQuote("sku-1"), TimeSpan.FromSeconds(5), ct);

What changed since v6

The migration guide has the details: before and after for each change, and what v6 and v7 apps on one broker share.