-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathActiveMqQueueMessageAdapterConstructor.cs
More file actions
53 lines (47 loc) · 1.83 KB
/
ActiveMqQueueMessageAdapterConstructor.cs
File metadata and controls
53 lines (47 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using ViennaNET.Messaging.Configuration;
using ViennaNET.Messaging.Factories.Impl;
using ViennaNET.Utils;
namespace ViennaNET.Messaging.ActiveMQQueue
{
/// <inheritdoc />
public class ActiveMqQueueMessageAdapterConstructor : QueueMessageAdapterConstructorBase<ActiveMqConfiguration,
ActiveMqQueueConfiguration>
{
private readonly IActiveMqConnectionFactory _connectionFactory;
private readonly ILoggerFactory _loggerFactory;
/// <inheritdoc />
public ActiveMqQueueMessageAdapterConstructor(IConfiguration configuration,
ILoggerFactory loggerFactory,
IActiveMqConnectionFactory connectionFactory)
: base(configuration, "activemq")
{
_loggerFactory = loggerFactory;
_connectionFactory = connectionFactory;
}
/// <inheritdoc />
protected override IMessageAdapter CreateAdapter(ActiveMqQueueConfiguration queueConfiguration)
{
queueConfiguration.ThrowIfNull(nameof(queueConfiguration));
if (queueConfiguration.TransactionEnabled)
{
return new ActiveMqQueueTransactedMessageAdapter(_connectionFactory,
queueConfiguration,
_loggerFactory.CreateLogger<ActiveMqQueueTransactedMessageAdapter>());
}
if (queueConfiguration.ProcessingType == MessageProcessingType.Subscribe ||
queueConfiguration.ProcessingType == MessageProcessingType.SubscribeAndReply)
{
return new ActiveMqQueueSubscribingMessageAdapter(
_connectionFactory,
queueConfiguration,
_loggerFactory.CreateLogger<ActiveMqQueueSubscribingMessageAdapter>());
}
return new ActiveMqQueueMessageAdapter(
_connectionFactory,
queueConfiguration,
_loggerFactory.CreateLogger<ActiveMqQueueMessageAdapter>());
}
}
}