Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 7 days ago
JSON representation

MessageBrokerService (RabbitMQ).

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();
}
}
```