Skip to content

Commit 317cae5

Browse files
authored
1.1.9 (#2)
Adjusting the project structure to allow for comfortable grow of the library.
1 parent d3e5d28 commit 317cae5

28 files changed

Lines changed: 254 additions & 221 deletions

File tree

RabbitExpress.ExamplePublisher/Program.cs renamed to Examples/RabbitExpress.Example.Publisher/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
// along with this RabbitExpress. If not, see <http://www.gnu.org/licenses/>.
2727
// </summary>
2828
// ***********************************************************************
29-
namespace RabbitExpress.ExamplePublisher
29+
namespace RabbitExpress.Example.Publisher
3030
{
31-
using ExampleShared;
3231
using Microsoft.Extensions.Configuration;
32+
using Shared;
3333
using System;
3434
using System.IO;
3535

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Example Publisher
2+
3+
This project makes use of the [RabbitExpress.QueueClient](../../RabbitExpress/README.md) and utilizes the [RabbitExpress.Serializers.JsonSerializer](../../Serializers/RabbitExpress.Serializers.JsonSerializer/README.md) when communicating with the queue.
4+
5+
## Add the reference
6+
7+
In the csproj add a PackageReference to the [RabbitExpress.Serializers.JsonSerializer](../../Serializers/RabbitExpress.Serializers.JsonSerializer/README.md)
8+
9+
```xml
10+
<ItemGroup>
11+
<PackageReference Include="RabbitExpress.Serializers.JsonSerializer" Version="1.*" />
12+
</ItemGroup>
13+
```
14+
or the [RabbitExpress.Serializers.MsgPackSerializer](../../Serializers/RabbitExpress.Serializers.MsgPackSerializer/README.md) package.
15+
```xml
16+
<ItemGroup>
17+
<PackageReference Include="RabbitExpress.Serializers.MsgPackSerializer" Version="1.*" />
18+
</ItemGroup>
19+
```
20+
21+
## A simple publisher
22+
23+
The main code makes use of predefined messages and queues. See [RabbitExpress.Example.Shared](../RabbitExpress.Example.Shared/README.md) for details.
24+
25+
Making use of the the publisher is as simple as:
26+
27+
```c-sharp
28+
using (var qc = new QueueClient<Queues, JsonSerializer>(new Uri(config["RabbitExpressConnection"])))
29+
{
30+
string message;
31+
do
32+
{
33+
Console.Write("Message: ");
34+
message = Console.ReadLine();
35+
qc.Publish(new ExampleMessage { Text = message }, Queues.EXAMPLE_QUEUE);
36+
} while (message != "exit");
37+
}
38+
```
39+
40+
This simple code will publish an ExampleMessage to the [RabbitMQ](https://www.rabbitmq.com/) queue called EXAMPLE_QUEUE.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.2</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
10+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
11+
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
12+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\RabbitExpress.Example.Shared\RabbitExpress.Example.Shared.csproj" />
17+
<ProjectReference Include="..\..\Serializers\RabbitExpress.Serializers.JsonSerializer\RabbitExpress.Serializers.JsonSerializer.csproj" />
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<None Update="appsettings.json">
22+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
23+
</None>
24+
</ItemGroup>
25+
26+
</Project>
File renamed without changes.

RabbitExpress.ExampleShared/ExampleMessage.cs renamed to Examples/RabbitExpress.Example.Shared/ExampleMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// along with this RabbitExpress. If not, see <http://www.gnu.org/licenses/>.
2727
// </summary>
2828
// ***********************************************************************
29-
namespace RabbitExpress.ExampleShared
29+
namespace RabbitExpress.Example.Shared
3030
{
3131
/// <summary>
3232
/// Class ExampleMessage.

RabbitExpress.ExampleShared/Queues.cs renamed to Examples/RabbitExpress.Example.Shared/Queues.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// along with this RabbitExpress. If not, see <http://www.gnu.org/licenses/>.
2727
// </summary>
2828
// ***********************************************************************
29-
namespace RabbitExpress.ExampleShared
29+
namespace RabbitExpress.Example.Shared
3030
{
3131
/// <summary>
3232
/// Enum Queues
File renamed without changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
</Project>

RabbitExpress.ExampleWorker/Program.cs renamed to Examples/RabbitExpress.Example.Worker/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
// along with this RabbitExpress. If not, see <http://www.gnu.org/licenses/>.
2727
// </summary>
2828
// ***********************************************************************
29-
namespace RabbitExpress.ExampleWorker
29+
namespace RabbitExpress.Example.Worker
3030
{
31-
using ExampleShared;
3231
using Microsoft.Extensions.Configuration;
32+
using Shared;
3333
using System;
3434
using System.IO;
3535

RabbitExpress.ExampleWorker/README.md renamed to Examples/RabbitExpress.Example.Worker/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
# Example Worker
22

3-
This project makes use of the [RabbitExpress.QueueClient](../RabbitExpress/README.md) and utilizes the [RabbitExpress.JsonSerializer](../RabbitExpress.JsonSerializer/README.md) when communicating with the queue.
3+
This project makes use of the [RabbitExpress.QueueClient](../../RabbitExpress/README.md) and utilizes the [RabbitExpress.Serializers.JsonSerializer](../../Serializers/RabbitExpress.Serializers.JsonSerializer/README.md) when communicating with the queue.
44

55
## Add the reference
66

7-
In the csproj add a PackageReference to the [RabbitExpress.JsonSerializer](../RabbitExpress.JsonSerializer/README.md) package.
7+
In the csproj add a PackageReference to the [RabbitExpress.Serializers.JsonSerializer](../../Serializers/RabbitExpress.Serializers.JsonSerializer/README.md)
88

99
```xml
1010
<ItemGroup>
11-
<PackageReference Include="RabbitExpress.JsonSerializer" Version="*" />
11+
<PackageReference Include="RabbitExpress.Serializers.JsonSerializer" Version="1.*" />
12+
</ItemGroup>
13+
```
14+
or the [RabbitExpress.Serializers.MsgPackSerializer](../../Serializers/RabbitExpress.Serializers.MsgPackSerializer/README.md) package.
15+
```xml
16+
<ItemGroup>
17+
<PackageReference Include="RabbitExpress.Serializers.MsgPackSerializer" Version="1.*" />
1218
</ItemGroup>
1319
```
1420

1521
## A simple worker
1622

17-
The main code makes use of predefined messages and queues. See [RabbitExpress.ExampleShared](../RabbitExpress.ExampleShared/README.md) for details.
23+
The main code makes use of predefined messages and queues. See [RabbitExpress.Example.Shared](../RabbitExpress.Example.Shared/README.md) for details.
1824

19-
Making use of the the worker is a little more involved than [using the client for publishing](../RabbitExpress.ExamplePublisher/README.md).
25+
Making use of the the worker is a little more involved than [using the client for publishing](../RabbitExpress.Example.Publisher/README.md).
2026

2127
```c-sharp
2228
using (var qc = new QueueClient<Queues, JsonSerializer>(new Uri(config["RabbitExpressConnection"])))
@@ -54,4 +60,3 @@ using (var qc = new QueueClient<Queues, JsonSerializer>(new Uri(config["RabbitEx
5460
```
5561

5662
This simple code will continuously wait for an ExampleMessage on the [RabbitMQ](https://www.rabbitmq.com/) queue called EXAMPLE_QUEUE. The most important part is ```gc.WatchQueue<ExampleMessage>(Queues.<QueueName>, ...);```. The delegate passed to this function will be called for every valid received message.
57-

0 commit comments

Comments
 (0)