Skip to content

Commit 5703062

Browse files
committed
Merge branch 'release/2.8'
2 parents 5fb3afb + 46e498b commit 5703062

File tree

63 files changed

+630
-3494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+630
-3494
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<RootNamespace>_08_MessageHandlerLogging</RootNamespace>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
11+
<PackageReference Include="SimpleInjector" Version="5.3.0" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\..\Tapeti.Serilog\Tapeti.Serilog.csproj" />
16+
<ProjectReference Include="..\ExampleLib\ExampleLib.csproj" />
17+
<ProjectReference Include="..\Messaging.TapetiExample\Messaging.TapetiExample.csproj" />
18+
<ProjectReference Include="..\..\Tapeti.SimpleInjector\Tapeti.SimpleInjector.csproj" />
19+
<ProjectReference Include="..\..\Tapeti\Tapeti.csproj" />
20+
</ItemGroup>
21+
22+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using ExampleLib;
4+
using Messaging.TapetiExample;
5+
using Serilog;
6+
using Serilog.Events;
7+
using SimpleInjector;
8+
using Tapeti;
9+
using Tapeti.Serilog;
10+
using Tapeti.SimpleInjector;
11+
using ILogger = Tapeti.ILogger;
12+
13+
namespace _08_MessageHandlerLogging
14+
{
15+
public class Program
16+
{
17+
public static void Main()
18+
{
19+
var container = new Container();
20+
var dependencyResolver = new SimpleInjectorDependencyResolver(container);
21+
22+
var seriLogger = new LoggerConfiguration()
23+
.MinimumLevel.Debug()
24+
25+
// Include {Properties} or specific keys in the output template to see properties added to the diagnostic context
26+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties}{NewLine}{Exception}")
27+
.CreateLogger();
28+
29+
container.RegisterInstance((Serilog.ILogger)seriLogger);
30+
container.Register<ILogger, TapetiSeriLogger.WithMessageLogging>();
31+
32+
33+
var helper = new ExampleConsoleApp(dependencyResolver);
34+
helper.Run(MainAsync);
35+
36+
seriLogger.Dispose();
37+
}
38+
39+
40+
internal static async Task MainAsync(IDependencyResolver dependencyResolver, Func<Task> waitForDone)
41+
{
42+
var config = new TapetiConfig(dependencyResolver)
43+
.WithMessageHandlerLogging()
44+
.RegisterAllControllers()
45+
.Build();
46+
47+
48+
await using var connection = new TapetiConnection(config);
49+
var subscriber = await connection.Subscribe(false);
50+
51+
52+
var publisher = dependencyResolver.Resolve<IPublisher>();
53+
await publisher.Publish(new PublishSubscribeMessage
54+
{
55+
Greeting = "Hello message handler logging!"
56+
});
57+
58+
await subscriber.Resume();
59+
await waitForDone();
60+
}
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using ExampleLib;
4+
using Messaging.TapetiExample;
5+
using Tapeti.Annotations;
6+
7+
namespace _08_MessageHandlerLogging
8+
{
9+
[MessageController]
10+
[DynamicQueue("tapeti.example.08.slow")]
11+
public class SlowMessageController
12+
{
13+
private readonly IExampleState exampleState;
14+
15+
16+
public SlowMessageController(IExampleState exampleState)
17+
{
18+
this.exampleState = exampleState;
19+
}
20+
21+
22+
public async Task GimmeASec(PublishSubscribeMessage message)
23+
{
24+
Console.WriteLine("Received message (in slow controller): " + message.Greeting);
25+
26+
await Task.Delay(1000);
27+
28+
exampleState.Done();
29+
}
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using Messaging.TapetiExample;
3+
using Tapeti.Annotations;
4+
using Tapeti.Serilog;
5+
6+
namespace _08_MessageHandlerLogging
7+
{
8+
[MessageController]
9+
[DynamicQueue("tapeti.example.08.speedy")]
10+
public class SpeedyMessageController
11+
{
12+
// ReSharper disable once InconsistentNaming
13+
public void IAmSpeed(PublishSubscribeMessage message, IDiagnosticContext diagnosticContext)
14+
{
15+
diagnosticContext.Set("PropertySetByMessageHandler", 42);
16+
17+
Console.WriteLine("Received message (in speedy controller): " + message.Greeting);
18+
}
19+
}
20+
}

Examples/Messaging.TapetiExample/Messaging.TapetiExample.csproj

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
<ItemGroup>
88
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
9-
</ItemGroup>
10-
11-
<ItemGroup>
12-
<ProjectReference Include="..\..\Tapeti.Annotations\Tapeti.Annotations.csproj" />
9+
<PackageReference Include="Tapeti.Annotations" Version="3.0.0" />
1310
</ItemGroup>
1411

1512
</Project>

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
## Introduction
23
Tapeti is a wrapper for the RabbitMQ .NET Client designed for long-running microservices. It’s main goal is to minimize the amount of messaging code required, and instead focus on the higher-level flow.
34

@@ -47,6 +48,17 @@ The documentation for Tapeti is available on Read the Docs:
4748
[![Documentation Status](https://readthedocs.org/projects/tapeti/badge/?version=latest)](http://tapeti.readthedocs.io/en/latest/introduction.html?badge=latest)
4849

4950

51+
## Related repositories
52+
Parts of Tapeti have been split into their own repository. This allows them to have their own version numbers which increases compatibility between shared message packages when services use different Tapeti versions.
53+
54+
- [Tapeti.Annotations](https://github.com/MvRens/Tapeti.Annotations)
55+
annotations used in message classes, like [Request]
56+
57+
- [Tapeti.DataAnnotations.Extensions](https://github.com/MvRens/Tapet.DataAnnotations.Extensions)
58+
generic data annotation attributes useful in messages, like the [RequiredGuid] attribute
59+
60+
- [Tapeti.Cmd](https://github.com/MvRens/Tapeti.Cmd)
61+
the standalone tool to manage RabbitMQ messages and queues, focused on Tapeti-compatible messages
5062

5163
## Builds
5264
Builds are automatically run using AppVeyor, with the resulting packages being pushed to NuGet.

Tapeti.Annotations/DurableQueueAttribute.cs

-28
This file was deleted.

Tapeti.Annotations/DynamicQueueAttribute.cs

-32
This file was deleted.

Tapeti.Annotations/MandatoryAttribute.cs

-15
This file was deleted.

Tapeti.Annotations/MessageControllerAttribute.cs

-16
This file was deleted.

0 commit comments

Comments
 (0)