2
2
3
3
using System ;
4
4
using System . Linq ;
5
+ using WorkflowCore . Interface ;
5
6
6
7
#endregion
7
8
8
9
namespace WorkflowCore . QueueProviders . SqlServer . Services
9
10
{
11
+ public class BrokerNames
12
+ {
13
+ public BrokerNames ( string msgType , string initiatorService , string targetService , string contractName , string queueName )
14
+ {
15
+ MsgType = msgType ;
16
+ InitiatorService = initiatorService ;
17
+ TargetService = targetService ;
18
+ ContractName = contractName ;
19
+ QueueName = queueName ;
20
+ }
21
+
22
+ public string MsgType { get ; }
23
+ public string InitiatorService { get ; }
24
+ public string TargetService { get ; }
25
+ public string ContractName { get ; }
26
+ public string QueueName { get ; }
27
+ }
10
28
/// <summary>
11
29
/// Build names for SSSB objects
12
30
/// </summary>
@@ -15,46 +33,46 @@ namespace WorkflowCore.QueueProviders.SqlServer.Services
15
33
/// </remarks>
16
34
public class BrokerNamesProvider : IBrokerNamesProvider
17
35
{
36
+ readonly BrokerNames _workFlowNames ;
37
+ readonly BrokerNames _eventNames ;
38
+
18
39
/// <summary>
19
40
/// ctor
20
41
/// </summary>
21
42
/// <param name="workflowHostName"></param>
22
43
public BrokerNamesProvider ( string workflowHostName )
23
44
{
24
- WorkflowMessageType = "//workflow-core/workflow" ;
25
- EventMessageType = "//workflow-core/event" ;
45
+ var workflowMessageType = "//workflow-core/workflow" ;
46
+ var eventMessageType = "//workflow-core/event" ;
26
47
27
- EventContractName = "//workflow-core/eventContract" ;
28
- WorkflowContractName = "//workflow-core/workflowContract" ;
48
+ var eventContractName = "//workflow-core/eventContract" ;
49
+ var workflowContractName = "//workflow-core/workflowContract" ;
29
50
30
- InitiatorEventServiceName = $ "//workflow-core/{ workflowHostName } /initiatorEventService";
31
- TargetEventServiceName = $ "//workflow-core/{ workflowHostName } /targetEventService";
51
+ var initiatorEventServiceName = $ "//workflow-core/{ workflowHostName } /initiatorEventService";
52
+ var targetEventServiceName = $ "//workflow-core/{ workflowHostName } /targetEventService";
32
53
33
- InitiatorWorkflowServiceName = $ "//workflow-core/{ workflowHostName } /initiatorWorkflowService";
34
- TargetWorkflowServiceName = $ "//workflow-core/{ workflowHostName } /targetWorkflowService";
54
+ var initiatorWorkflowServiceName = $ "//workflow-core/{ workflowHostName } /initiatorWorkflowService";
55
+ var targetWorkflowServiceName = $ "//workflow-core/{ workflowHostName } /targetWorkflowService";
35
56
36
- EventQueueName = $ "//workflow-core/{ workflowHostName } /eventQueue";
37
- WorkflowQueueName = $ "//workflow-core/{ workflowHostName } /workflowQueue";
57
+ var eventQueueName = $ "//workflow-core/{ workflowHostName } /eventQueue";
58
+ var workflowQueueName = $ "//workflow-core/{ workflowHostName } /workflowQueue";
59
+
60
+ _workFlowNames = new BrokerNames ( workflowMessageType , initiatorWorkflowServiceName , targetWorkflowServiceName , workflowContractName , eventQueueName ) ;
61
+ _eventNames = new BrokerNames ( eventMessageType , initiatorEventServiceName , targetEventServiceName , eventContractName , workflowQueueName ) ;
38
62
}
39
63
40
- public string WorkflowContractName { get ; }
41
-
42
- public string TargetEventServiceName { get ; }
43
-
44
- public string InitiatorEventServiceName { get ; }
45
-
46
- public string WorkflowQueueName { get ; }
47
-
48
- public string EventQueueName { get ; }
49
-
50
- public string TargetWorkflowServiceName { get ; }
51
-
52
- public string InitiatorWorkflowServiceName { get ; }
53
-
54
- public string EventContractName { get ; }
55
-
56
- public string EventMessageType { get ; }
64
+ public BrokerNames GetByQueue ( QueueType queue )
65
+ {
66
+ switch ( queue )
67
+ {
68
+ case QueueType . Workflow :
69
+ return _workFlowNames ;
70
+ case QueueType . Event :
71
+ return _eventNames ;
72
+ default :
73
+ throw new ArgumentOutOfRangeException ( nameof ( queue ) , queue , null ) ;
74
+ }
57
75
58
- public string WorkflowMessageType { get ; }
76
+ }
59
77
}
60
78
}
0 commit comments