Skip to content

Commit

Permalink
Add SourceLink support
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Maruszak <maruszaktomasz@gmail.com>
  • Loading branch information
zarusz committed Jun 16, 2024
1 parent e60b21f commit 4d1f4f6
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ jobs:
run: |
mkdir ./dist
find -name "*.nupkg" -exec cp {} ./dist \;
find -name "*.snupkg" -exec cp {} ./dist \;
find ./dist
- name: Archive NuGet packages
uses: actions/upload-artifact@v3
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ The `SlimMessageBus` configuration for the in-memory provider looks like this:
```cs
//IServiceCollection services;
// Cofigure the message bus
// Configure the message bus
services.AddSlimMessageBus(mbb =>
{
mbb.WithProviderMemory();
// Find types that implement IConsumer<T> and IRequestHandler<T, R> and declare producers and consumers on the mbb
mbb.AutoDeclareFrom(Assembly.GetExecutingAssembly());
// Scan assembly for consumers, handlers, interceptors and configurators and register into MSDI
// Scan assembly for consumers, handlers, interceptors, and register into MSDI
mbb.AddServicesFromAssemblyContaining<OrderSubmittedHandler>();
});
```
Expand Down Expand Up @@ -318,10 +318,11 @@ See [sample](/src/Samples/README.md#sampleimages).
- A hybrid of the above (e.g. Kafka with multiple topic consumers in one group)
- Modern async/await syntax and TPL
- Fluent configuration
- Because SlimMessageBus is a facade, you can swap broker implementations
- [SourceLink](docs/intro.md#debugging) support
- Because SlimMessageBus is a facade, messaging transports can be change
- Using NuGet pull another broker provider
- Reconfigure SlimMessageBus and retest your app
- Try out the messaging middleware that works best for your app (Kafka vs. Redis) without having to rewrite your app.
- Try out the messaging system that works best for the use case (Kafka vs. Redis) without having to rewrite the app.

## Principles

Expand Down
2 changes: 1 addition & 1 deletion build/do_push_prod.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
. $PSScriptRoot\tasks.ps1

NuPush "https://www.nuget.org"
NuPush "https://api.nuget.org/v3/index.json"
5 changes: 3 additions & 2 deletions build/tasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,14 @@ function TestCi() {
function NuPack() {
foreach ($project in $projects) {
_Step "Package project $project"
& dotnet pack "$root\src\$project\$project.csproj" --output $dist_folder --configuration $config
& dotnet pack "$root\src\$project\$project.csproj" --output $dist_folder --configuration $config -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
_AssertExec
}
}

function NuPush($nuget_source) {
foreach ($package in Get-ChildItem $dist_folder -filter "*.nupkg" -name) {
# find both *.nupkg and *.snupkg files
foreach ($package in Get-ChildItem $dist_folder -filter "*.nupkg" -name) {
_Step "Push $package to $nuget_source"
& dotnet nuget push "$dist_folder\$package" --source $nuget_source
_AssertExec
Expand Down
22 changes: 19 additions & 3 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- [Generic interceptors](#generic-interceptors)
- [Error Handling](#error-handling)
- [Logging](#logging)
- [Debugging](#debugging)
- [Provider specific functionality](#provider-specific-functionality)

## Configuration
Expand Down Expand Up @@ -1034,11 +1035,26 @@ This allows to specialize and prioritize error handlers by transport.

## Logging

SlimMessageBus uses [Microsoft.Extensions.Logging.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions).
SlimMessageBus uses [Microsoft.Extensions.Logging.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions):
The `ILoggerFactory` will be resolved from the dependency injection container.
- The `ILoggerFactory` will be resolved from the dependency injection container.
- When the `ILoggerFactory` is not configured nor available in the DI container SMB will use `NullLoggerFactory.Instance`.

When the `ILoggerFactory` is not configured nor available in the DI container SMB will use `NullLoggerFactory.Instance`.
## Debugging

To help with debugging SlimMessageBus:

- is integrated with [SourceLink](https://github.com/dotnet/sourcelink),
- publishes symbol packages (`*.pdb` inside `*.snupkg`) into [NuGet.org](https://www.nuget.org/packages?q=SlimMessageBus).
While in debugging mode, this should allow to step into code of the library, and see the source code tied to the library version that is being used. See here a [demo with Visual Studio](https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/sourcelink).
Ensure [Visual Studio is configured](https://learn.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2022) to make this work:
- `Options > Debugging > General > Enable Just My Code` is unchecked
- `Options > Debugging > Symbols > NuGet.org Symbol Server` is checked

> Since v2.4.0

## Provider specific functionality

Expand Down
22 changes: 19 additions & 3 deletions docs/intro.t.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- [Generic interceptors](#generic-interceptors)
- [Error Handling](#error-handling)
- [Logging](#logging)
- [Debugging](#debugging)
- [Provider specific functionality](#provider-specific-functionality)

## Configuration
Expand Down Expand Up @@ -1020,11 +1021,26 @@ This allows to specialize and prioritize error handlers by transport.

## Logging

SlimMessageBus uses [Microsoft.Extensions.Logging.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions).
SlimMessageBus uses [Microsoft.Extensions.Logging.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions):
The `ILoggerFactory` will be resolved from the dependency injection container.
- The `ILoggerFactory` will be resolved from the dependency injection container.
- When the `ILoggerFactory` is not configured nor available in the DI container SMB will use `NullLoggerFactory.Instance`.

When the `ILoggerFactory` is not configured nor available in the DI container SMB will use `NullLoggerFactory.Instance`.
## Debugging

To help with debugging SlimMessageBus:

- is integrated with [SourceLink](https://github.com/dotnet/sourcelink),
- publishes symbol packages (`*.pdb` inside `*.snupkg`) into [NuGet.org](https://www.nuget.org/packages?q=SlimMessageBus).
While in debugging mode, this should allow to step into code of the library, and see the source code tied to the library version that is being used. See here a [demo with Visual Studio](https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/sourcelink).
Ensure [Visual Studio is configured](https://learn.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2022) to make this work:
- `Options > Debugging > General > Enable Just My Code` is unchecked
- `Options > Debugging > Symbols > NuGet.org Symbol Server` is checked

> Since v2.4.0

## Provider specific functionality

Expand Down
17 changes: 16 additions & 1 deletion docs/plugin_outbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,22 @@ builder.Services.AddSlimMessageBus(mbb =>
})
.AddChildBus("AzureSB", mbb =>
{
mbb.WithProviderServiceBus(cfg => cfg.ConnectionString = Secrets.Service.PopulateSecrets(configuration["Azure:ServiceBus"]))
mbb
.Handle<CreateCustomerCommand, Guid>(s =>
{
s.Topic("samples.outbox/customer-events", t =>
{
t.WithHandler<CreateCustomerCommandHandler, CreateCustomerCommand>()
.SubscriptionName("CreateCustomer");
});
})
.WithProviderServiceBus(cfg =>
{
cfg.ConnectionString = Secrets.Service.PopulateSecrets(configuration["Azure:ServiceBus"]);
cfg.TopologyProvisioning.CanProducerCreateTopic = true;
cfg.TopologyProvisioning.CanConsumerCreateQueue = true;
cfg.TopologyProvisioning.CanConsumerReplaceSubscriptionFilters = true;
})
.Produce<CustomerCreatedEvent>(x =>
{
x.DefaultTopic("samples.outbox/customer-events");
Expand Down
11 changes: 11 additions & 0 deletions src/Common.NuGet.Properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

<!-- Source Link - Start -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>
<!-- Source Link - Finish -->

<ItemGroup>
<None Include="..\..\docs\NuGet.md" Pack="true" PackagePath="\"/>
<None Include="..\..\icon.png">
Expand Down
2 changes: 1 addition & 1 deletion src/Host.Plugin.Properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Import Project="Common.NuGet.Properties.xml" />

<PropertyGroup>
<Version>2.4.0-rc1</Version>
<Version>2.4.0-rc5</Version>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description>Core configuration interfaces of SlimMessageBus</Description>
<PackageTags>SlimMessageBus</PackageTags>
<RootNamespace>SlimMessageBus.Host</RootNamespace>
<Version>2.0.7</Version>
<Version>2.0.8-rc3</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="../Common.NuGet.Properties.xml" />

<PropertyGroup>
<Version>2.0.2</Version>
<Version>2.0.3-rc3</Version>
<Description>Core interceptor interfaces of SlimMessageBus</Description>
<PackageTags>SlimMessageBus</PackageTags>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="../Common.NuGet.Properties.xml" />

<PropertyGroup>
<Version>2.0.2</Version>
<Version>2.0.3-rc3</Version>
<Description>Core serialization interfaces of SlimMessageBus</Description>
<PackageTags>SlimMessageBus</PackageTags>
</PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/SlimMessageBus.sln
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{1A71BB05
ProjectSection(SolutionItems) = preProject
..\build\do_build.ps1 = ..\build\do_build.ps1
..\build\do_package.ps1 = ..\build\do_package.ps1
..\build\do_push_local.ps1 = ..\build\do_push_local.ps1
..\build\do_push_prod.ps1 = ..\build\do_push_prod.ps1
..\build\do_test.ps1 = ..\build\do_test.ps1
..\build\do_test_ci.ps1 = ..\build\do_test_ci.ps1
..\build\tasks.ps1 = ..\build\tasks.ps1
Expand Down
2 changes: 1 addition & 1 deletion src/SlimMessageBus/SlimMessageBus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="../Common.NuGet.Properties.xml" />

<PropertyGroup>
<Version>2.0.2</Version>
<Version>2.0.3-rc3</Version>
<Description>A lightweight message bus interface for .NET. The goal of this library is to introduce a slim facade for messaging brokers. Use one of the transport providers for popular messaging systems or in-process (in-memory) messaging.</Description>
<NeutralLanguage />
<PackageTags>MessageBus facade EventBus broker events messages message bus DomainEvents domain DDD messaging EDA mediator</PackageTags>
Expand Down

0 comments on commit 4d1f4f6

Please sign in to comment.