Skip to content

Releases: zarusz/SlimMessageBus

Host-Transport-2.0.0-rc5: Upgrade the underlying transport client libraries

09 Mar 22:59
Compare
Choose a tag to compare
  1. SMB uses Microsoft.Extensions.DependencyInjection.Abstractions at the core.
  2. Removed Unity and Autofac plugins.
  3. Repurpose the SlimMessageBus.Host.AspNetCore plugin to just configure the MessageBus.Current static accessor.
  4. An implementation of IHostedService is registered that starts consumers when used with the .NET Generic Host.
  5. SMB can assume the consumer type of IConsumer<TMessage> and hence the .WithConsumer<SomeConsumer>() can be skipped most of the time.
  6. Support for requests that do not have a response type associated with it (new types IRequestHandler<TRequest>, IRequest)
  7. The IRequest<TResponse> is the new replacement for IRequestMessage<TResponse> (please migrate).
  8. Streamlined the bus configuration.
  9. Upgrade the underlying transport client libraries to latest versions (Redis, Kafka, Azure Service Bus, Azure Event Hub).

Ad 1 and 2.

Uninstall packages:

  • SlimMessageBus.Host.Autofac
  • SlimMessageBus.Host.Unity
  • SlimMessageBus.Host.MsDependencyInjection

Ad 5 and 8.

Old way:

services.AddSlimMessageBus((mbb, svp) =>
{
  mbb.Consume<CustomerCreatedEvent>(x => x
          .Topic(topic)
          .WithConsumer<CustomerCreatedEventConsumer>() // Change (1)
          .SubscriptionName("sub");  
  });
  mbb.WithSerializer(new JsonMessageSerializer()); // Change (2)
}, addConsumersFromAssembly: new[] { Assembly.GetExecutingAssembly() }); // Change (3)

New way:

services.AddSlimMessageBus((mbb, svp) =>
{
  mbb.Consume<CustomerCreatedEvent>(x => x
          .Topic(topic)
          // The line below is now optional (1)
          // .WithConsumer<CustomerCreatedEventConsumer>() // Not needed, the IConsumer<CustomerCreatedEvent> will be looked up in DI
          .SubscriptionName("sub");
  });
});
services.AddMessageBusServicesFromAssembly(Assembly.GetExecutingAssembly())); // (3)
services.AddMessageBusJsonMessageSerializer(); // requires SlimMessageBus.Host.Serialization.Json package // (2)

Also, the .AddMessageBusServicesFromAssembly() will register both CustomerCreatedEventConsumer and IConsumer<CustomerCreatedEvent> service types in the MSDI.


Ad 3.

Old way:

// Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
  // Set the MessageBus provider, so that IMessageBus are resolved from the current request scope
  MessageBus.SetProvider(MessageBusCurrentProviderBuilder.Create().From(app).Build());
}

New way:

services.AddHttpContextAccessor(); // This is required for the SlimMessageBus.Host.AspNetCore plugin
services.AddMessageBusAspNet();

Ad 6.

The request processing will be awaited during .Send(), however, no response will be returned. If an exception were to happen on the handler side the exception will be thrown by the .Send().

Consider the following example:

// The request has to use the IRequest interface
public class SomeRequest : IRequest
{
}

// The handler has to use IRequestHandler<T> interface
public class SomeRequestHandler : IRequestHandler<SomeRequest>
{
  public async Task OnHandle(SomeRequest request)
  {
    // no response returned
  }
}

// The request is declared on the bus builder (for the producer side)
mbb.Produce<SomeRequest>(x =>
{
  x.DefaultTopic("topic");
})

// The request handler is declared on the bus builder (for the consumer side)
mbb.Handle<SomeRequest>(x => x
    .Topic("topic") // Topic to expect the requests on
    //.WithHandler<SomeRequestHandler>()
    .KafkaGroup("some-consumer-group") // kafka provider specific
);

// Usage example for the producer side
await bus.Send(new SampleRequest());

Ad 8.

  • The .AddSlimMessageBus()
    • configuration lambda is wrapped and registered as an IMessageBusConfigurator in MSDI.
    • can be used multiple times (internally it uses services.TryAddTransient())
    • has a parameterless overload if used purely with IMessageBusConfigurator modular approach
    • The MessageBusBuilder is registered in the MSDI
  • All the serializers can be added to MSDI using respective extension methods (.AddMessageBusJsonSerializer(), .AddMessageBusAvroSerializer(), etc).
  • All the plugins have a uniform set of extension methods that start with .AddMessageBusXxxx() to easily identify what comes from SMB.

Host.Transport-2.0.0-rc3

27 Feb 22:55
Compare
Choose a tag to compare
Pre-release
  1. SMB uses Microsoft.Extensions.DependencyInjection.Abstractions at the core.
  2. Remove Unity and Autofac plugins.
  3. Repurpose the SlimMessageBus.Host.AspNetCore plugin to just configure the MessageBus.Current static accessor.
  4. An implementation of IHostedService is registered that starts consumers when used with the .NET Generic Host.
  5. SMB can assume the consumer type of IConsumer<TMessage> and hence the .WithConsumer<SomeConsumer>() can be skipped most of the time.
  6. Support for requests that do not have a response type associated with it (new types IRequestHandler<TRequest>, IRequest)
  7. The IRequest<TResponse> is the new replacement for IRequestMessage<TResponse> (please migrate).

Ad 5.

services.AddSlimMessageBus((mbb, svp) =>
{
  mbb.Consume<CustomerCreatedEvent>(x => x
          .Topic(topic)
          // The line below is now optional
          // .WithConsumer<CustomerCreatedEventConsumer>()
          .SubscriptionName("sub");
  });
}, addConsumersFromAssembly: new[] { Assembly.GetExecutingAssembly() });

With this change, the addConsumersFromAssembly will register both CustomerCreatedEventConsumer and IConsumer<CustomerCreatedEvent> in the MSDI.


Ad 3.

Old way:

// Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
  // Set the MessageBus provider, so that IMessageBus are resolved from the current request scope
  MessageBus.SetProvider(MessageBusCurrentProviderBuilder.Create().From(app).Build());
}

New way:

services.AddHttpContextAccessor(); // This is required for the SlimMessageBus.Host.AspNetCore plugin
services.AddMessageBusAspNet();

Ad 6.

The request processing will be awaited during .Send(), however, no response will be returned. If an exception were to happen on the handler side the exception will be thrown by the .Send().

Consider the following example:

// The request has to use the IRequest interface
public class SomeRequest : IRequest
{
}

// The handler has to use IRequestHandler<T> interface
public class SomeRequestHandler : IRequestHandler<SomeRequest>
{
  public async Task OnHandle(SomeRequest request)
  {
    // no response returned
  }
}

// The request is declared on the bus builder (for the producer side)
mbb.Produce<SomeRequest>(x =>
{
  x.DefaultTopic("topic");
})

// The request handler is declared on the bus builder (for the consumer side)
mbb.Handle<SomeRequest>(x => x
    .Topic("topic") // Topic to expect the requests on
    .WithHandler<SomeRequestHandler>()
    .KafkaGroup("some-consumer-group") // kafka provider specific
);

// Usage example for the producer side
await bus.Send(new SampleRequest());

Host.Transport-2.0.0-rc2

24 Feb 22:54
Compare
Choose a tag to compare
Pre-release
  • SMB uses Microsoft.Extensions.DependencyInjection.Abstractions at the core.
  • Remove Unity and Autofac plugins.
  • An implementation if IHostedService us registered that starts consumers when used with the .NET Generic Host.
  • Repurpose the SlimMessageBus.Host.AspNetCore plugin to just configure the MessageBus.Current static accessor.
  • SMB can assume the consumer type of IConsumer<TMessage> and hence the .WithConsumer<SomeConsumer>() can be skipped most of the time.

Before:

services.AddSlimMessageBus((mbb, svp) =>
{
  mbb.Consume<CustomerCreatedEvent>(x => x
          .Topic(topic)
          .WithConsumer<CustomerCreatedEventConsumer>() // <------- this
          .SubscriptionName("sub");
  });
}, addConsumersFromAssembly: new[] { Assembly.GetExecutingAssembly() });

After:

services.AddSlimMessageBus((mbb, svp) =>
{
  mbb.Consume<CustomerCreatedEvent>(x => x
          .Topic(topic)
          .SubscriptionName("sub");
  });
}, addConsumersFromAssembly: new[] { Assembly.GetExecutingAssembly() });

With this change, the addConsumersFromAssembly will register both CustomerCreatedEventConsumer and IConsumer<CustomerCreatedEvent> in the MSDI.


Breaking change for MessageBus.Current setup:

Old way:

// Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
  // Set the MessageBus provider, so that IMessageBus are resolved from the current request scope
  MessageBus.SetProvider(MessageBusCurrentProviderBuilder.Create().From(app).Build());
}

New way:

services.AddHttpContextAccessor(); // This is required for the SlimMessageBus.Host.AspNetCore plugin
services.AddMessageBusAspNet();

Host.Transport-2.0.0-rc1: Move to Microsoft.Extensions.DependencyInjection

20 Feb 23:11
Compare
Choose a tag to compare
  • SMB uses Microsoft.Extensions.DependencyInjection.Abstractions at the core for managing dependencies
  • Remove Unity and Autofac plugins
  • Register IHostedService that starts consumers when used with the .NET Generic Host
  • Repurpose the SlimMessageBus.Host.AspNetCore plugin to just configure the MessageBus.Current
  • Minor improvements for disposing of consumers.

Breaking changes:

  1. The MessageBus.Current is setup in a simpler way now:

Old way:

// Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
  // Set the MessageBus provider, so that IMessageBus are resolved from the current request scope
  MessageBus.SetProvider(MessageBusCurrentProviderBuilder.Create().From(app).Build());
}

New way:

services.AddHttpContextAccessor(); // This is required for the SlimMessageBus.Host.AspNetCore plugin
services.AddMessageBusAspNet();

Host.Transport-1.22.1

23 Nov 22:02
Compare
Choose a tag to compare
  • [Host.Redis] Fix for Redis error log #140

Host.Transport-1.22.0

13 Nov 21:45
Compare
Choose a tag to compare
  • [Core] Drop path parameter from IConsumer and IRequestHandler<T, R> interfaces. #133
  • [Core] Optimize interceptor runtime by leveraging compiled expressions. #135
  • Upgrade client libraries to the latest. #137

Host.Transport-1.21.0

23 Oct 15:51
Compare
Choose a tag to compare
  • [Host] Ability to send various message types via the same topic/queue (see docs).
  • [Host] Better matching consumers to arriving polymorphic messages (no reliance on serializer, but MessageType header).
  • [Host.Memory] Autodeclare memory bus accounts for polymorphic messages (see docs).

Host.Transport-1.19.3

14 Aug 15:00
df6b63c
Compare
Choose a tag to compare
  • [Host.AzureServiceBus] Expose topology provision trigger (#124)
  • [Host.AzureServiceBus] Ability to manually trigger topology creation
  • [Host.AzureServiceBus] Improve topology provisioning edge case
  • [Host.Kafka] Fixes to handling error responses in request-response

Host.Transport-1.19.1

22 Jul 20:05
Compare
Choose a tag to compare
  • [Host.Memory] The memory bus can auto declare producers/consumers and handlers #119 - see docs.
  • [Host.AzureServiceuBus] Improvement to topology creation #117
  • Optimization to request-response (compiled expression)

Host.Transport-1.19.0

09 Jul 10:14
Compare
Choose a tag to compare
  • Ability to create Azure Service Bus topology (queue/topic/subscription) #38