Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit b534492

Browse files
committed
Aggiunta implementazione RabbitMQ Abstractions
1 parent 6da8910 commit b534492

File tree

6 files changed

+50
-0
lines changed

6 files changed

+50
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace NET6CustomLibrary.RabbitMQ.Abstractions;
2+
3+
internal class DefaultMessagingBuilder : IMessagingBuilder
4+
{
5+
public IServiceCollection Services { get; }
6+
7+
public DefaultMessagingBuilder(IServiceCollection services)
8+
{
9+
Services = services;
10+
}
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace NET6CustomLibrary.RabbitMQ.Abstractions;
2+
3+
public interface IMessageReceiver<T> where T : class
4+
{
5+
Task ReceiveAsync(T message, CancellationToken cancellationToken);
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace NET6CustomLibrary.RabbitMQ.Abstractions;
2+
3+
public interface IMessageSender
4+
{
5+
Task PublishAsync<T>(T message, int priority = 1) where T : class;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace NET6CustomLibrary.RabbitMQ.Abstractions;
2+
3+
public interface IMessagingBuilder
4+
{
5+
IServiceCollection Services { get; }
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace NET6CustomLibrary.RabbitMQ.Abstractions;
2+
3+
internal static class JsonOptions
4+
{
5+
public static JsonSerializerOptions Default { get; } = new(JsonSerializerDefaults.Web)
6+
{
7+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault
8+
};
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace NET6CustomLibrary.RabbitMQ.Abstractions;
2+
3+
public class QueueSettings
4+
{
5+
internal IList<(string Name, Type Type)> Queues { get; } = new List<(string, Type)>();
6+
7+
public void Add<T>(string queueName = null) where T : class
8+
{
9+
var type = typeof(T);
10+
Queues.Add((queueName ?? type.FullName, type));
11+
}
12+
}

0 commit comments

Comments
 (0)