Table of Contents

Setting Up Silverback

Silverback is designed as a modular framework, allowing you to include only the components you need. This guide walks you through selecting the right packages and configuring the basics to get started.

Adding the Required Packages

Core Packages

  • Silverback.Core – The essential package, including the message bus and fundamental messaging components.
  • Silverback.Core.Model – Enhances CQRS and event-driven architectures with improved semantics.

Message Broker Integration

If you need to integrate with a message broker, choose the appropriate package:

Additional Features

Storage Options

Certain Silverback features rely on a storage mechanism. Choose the appropriate package based on your needs:

Testing Support

For unit testing message-driven applications, you can use in-memory broker mocks:

Registering and Configuring Silverback

Once you’ve installed the necessary packages, configure Silverback within your application's Dependency Injection (DI) container.

You can use either AddSilverback or ConfigureSilverback to register and configure Silverback.

  • AddSilverback should typically be called once as the initial setup.
  • ConfigureSilverback allows extending the configuration in different parts of the bootstrap process, such as when configuring feature slices separately.

This is a basic example of configuring Silverback. Many settings and customization options are available depending on the features you want to use. For example, a message broker is optional, and you don’t need to configure both Kafka and MQTT unless required for your use case.

services.AddSilverback()
    .WithConnectionToMessageBroker(options => options
        .AddKafka()
        .AddMqtt())
    .AddSingletonSubscriber<MyMessageHandler>();
  • AddSilverback enables the message bus and allows chaining additional configurations via the fluent API.
  • WithConnectionToMessageBroker configures the connection to the message brokers (both Kafka and MQTT in this case).
  • AddSingletonSubscriber registers a message handler to process incoming messages.

Next Steps

With these steps, Silverback is now set up and ready to use! You can explore more advanced topics such as message processing, broker integration, and custom configurations in the following guides.