https://github.com/rafaelfgx/messagebrokerservice
MessageBrokerService (RabbitMQ).
https://github.com/rafaelfgx/messagebrokerservice
dot-net dot-net-core dotnet dotnet-core dotnetcore message-broker message-queue rabbitmq
Last synced: 4 months ago
JSON representation
MessageBrokerService (RabbitMQ).
- Host: GitHub
- URL: https://github.com/rafaelfgx/messagebrokerservice
- Owner: rafaelfgx
- License: mit
- Created: 2018-07-12T15:49:19.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-10-03T11:11:50.000Z (about 1 year ago)
- Last Synced: 2024-10-12T15:02:59.302Z (about 1 year ago)
- Topics: dot-net, dot-net-core, dotnet, dotnet-core, dotnetcore, message-broker, message-queue, rabbitmq
- Language: C#
- Homepage:
- Size: 4.88 KB
- Stars: 23
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# MessageBrokerService
[RabbitMQ](https://www.rabbitmq.com)
## IProductQueue
```csharp
public interface IProductQueue : IQueue { }
```
## ProductQueue
```csharp
public class ProductQueue : Queue, IProductQueue { }
```
## Publisher
```csharp
public static class Publisher
{
public static void Main()
{
Console.WriteLine(nameof(Publisher).ToUpper());
while (true)
{
Console.Write("Enter the product name: ");
var name = Console.ReadLine();
var product = new Product { Name = name };
IProductQueue productQueue = new ProductQueue();
productQueue.Publish(product);
}
}
}
```
## Subscriber
```csharp
public static class Subscriber
{
public static void Main()
{
Console.WriteLine(nameof(Subscriber).ToUpper());
IProductQueue productQueue = new ProductQueue();
productQueue.Subscribe((product) => Console.WriteLine(product.Name));
Console.ReadLine();
}
}
```