blob: 0eab6f90d0068a583672f0161f0ccf6ad73b1430 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
using RabbitMQ.Client;
namespace Spacebar.RabbitMqUtilities;
public interface IRabbitMQService {
Task<IConnection> CreateChannel();
}
public class RabbitMQService(RabbitMQConfiguration config) : IRabbitMQService {
public async Task<IConnection> CreateChannel() {
var connection = new ConnectionFactory {
UserName = config.Username,
Password = config.Password,
HostName = config.Host,
// DispatchConsumersAsync = true
};
var channel = await connection.CreateConnectionAsync();
return channel;
}
}
|