55
66namespace GeneXus . Messaging . GXAzureServiceBus
77{
8+ /// <summary>
9+ /// Implementation of AzureServiceBus.MessageBrokerProvider external object.
10+ /// </summary>
811 public class ServiceBusMessageBrokerProvider
912 {
10- public MessageQueue Connect ( string queueName , string connectionString , out GXBaseCollection < SdtMessages_Message > errorMessages , out bool success )
13+
14+ #region Azure Active Directory Authentication
15+
16+ public MessageQueue Authenticate ( string queueName , string fullyQualifiedNamespace , bool sessionEnabled , GxUserType receiverOptions , string senderIdentifier , out GXBaseCollection < SdtMessages_Message > errorMessages , out bool success )
1117 {
1218 MessageBrokerProvider messageBrokerProvider = new MessageBrokerProvider ( ) ;
13- GXProperties properties = new GXProperties ( ) ;
14- properties . Add ( PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , queueName ) ;
15- properties . Add ( PropertyConstants . MESSAGEBROKER_AZURESB_CONNECTIONSTRING , connectionString ) ;
19+ ReceiverOptions options = TransformGXUserTypeToReceiverOptions ( receiverOptions ) ;
20+
21+ GXProperties properties = new GXProperties
22+ {
23+ { PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , queueName } ,
24+ { PropertyConstants . MESSAGEBROKER_AZURESB_FULLYQUALIFIEDNAMESPACE , fullyQualifiedNamespace } ,
25+ { PropertyConstants . SESSION_ENABLED , sessionEnabled . ToString ( ) } ,
26+ { PropertyConstants . RECEIVE_MODE , options . ReceiveMode . ToString ( ) } ,
27+ { PropertyConstants . PREFETCH_COUNT , options . PrefetchCount . ToString ( ) } ,
28+ { PropertyConstants . RECEIVER_IDENTIFIER , options . Identifier } ,
29+ { PropertyConstants . RECEIVER_SESSIONID , options . SessionId } ,
30+ { PropertyConstants . SENDER_IDENTIFIER , senderIdentifier }
31+ } ;
1632
1733 MessageQueue messageQueue = messageBrokerProvider . Connect ( PropertyConstants . AZURESERVICEBUS , properties , out GXBaseCollection < SdtMessages_Message > errorMessagesConnect , out bool successConnect ) ;
1834 errorMessages = errorMessagesConnect ;
1935 success = successConnect ;
2036 return messageQueue ;
2137 }
2238
23- public MessageQueue Connect ( string topicName , string subcriptionName , string connectionString , out GXBaseCollection < SdtMessages_Message > errorMessages , out bool success )
39+ public MessageQueue Authenticate ( string topicName , string subcriptionName , string fullyQualifiedNamespace , bool sessionEnabled , GxUserType receiverOptions , string senderIdentifier , out GXBaseCollection < SdtMessages_Message > errorMessages , out bool success )
2440 {
2541 MessageBrokerProvider messageBrokerProvider = new MessageBrokerProvider ( ) ;
2642 GXProperties properties = new GXProperties ( ) ;
43+ ReceiverOptions options = TransformGXUserTypeToReceiverOptions ( receiverOptions ) ;
44+
2745 properties . Add ( PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , topicName ) ;
2846 properties . Add ( PropertyConstants . MESSAGEBROKER_AZURESB_SUBSCRIPTION_NAME , subcriptionName ) ;
29- properties . Add ( PropertyConstants . MESSAGEBROKER_AZURESB_CONNECTIONSTRING , connectionString ) ;
47+ properties . Add ( PropertyConstants . MESSAGEBROKER_AZURESB_FULLYQUALIFIEDNAMESPACE , fullyQualifiedNamespace ) ;
48+ properties . Add ( PropertyConstants . SESSION_ENABLED , sessionEnabled . ToString ( ) ) ;
49+ properties . Add ( PropertyConstants . RECEIVE_MODE , options . ReceiveMode . ToString ( ) ) ;
50+ properties . Add ( PropertyConstants . PREFETCH_COUNT , options . PrefetchCount . ToString ( ) ) ;
51+ properties . Add ( PropertyConstants . RECEIVER_IDENTIFIER , options . Identifier ) ;
52+ properties . Add ( PropertyConstants . RECEIVER_SESSIONID , options . SessionId ) ;
53+ properties . Add ( PropertyConstants . SENDER_IDENTIFIER , senderIdentifier ) ;
54+
55+ MessageQueue messageQueue = messageBrokerProvider . Connect ( PropertyConstants . AZURESERVICEBUS , properties , out GXBaseCollection < SdtMessages_Message > errorMessagesConnect , out bool successConnect ) ;
56+ errorMessages = errorMessagesConnect ;
57+ success = successConnect ;
58+ return messageQueue ;
59+ }
60+
61+ public MessageQueue authenticate ( string queueName , string fullyQualifiedNamespace , out GXBaseCollection < SdtMessages_Message > errorMessages , out bool success )
62+ {
63+ MessageBrokerProvider messageBrokerProvider = new MessageBrokerProvider ( ) ;
64+ GXProperties properties = new GXProperties
65+ {
66+ { PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , queueName } ,
67+ { PropertyConstants . MESSAGEBROKER_AZURESB_FULLYQUALIFIEDNAMESPACE , fullyQualifiedNamespace }
68+ } ;
69+
70+ MessageQueue messageQueue = messageBrokerProvider . Connect ( PropertyConstants . AZURESERVICEBUS , properties , out GXBaseCollection < SdtMessages_Message > errorMessagesConnect , out bool successConnect ) ;
71+ errorMessages = errorMessagesConnect ;
72+ success = successConnect ;
73+ return messageQueue ;
74+ }
75+ public MessageQueue authenticate ( string topicName , string subcriptionName , string fullyQualifiedNamespace , out GXBaseCollection < SdtMessages_Message > errorMessages , out bool success )
76+ {
77+ MessageBrokerProvider messageBrokerProvider = new MessageBrokerProvider ( ) ;
78+ GXProperties properties = new GXProperties
79+ {
80+ { PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , topicName } ,
81+ { PropertyConstants . MESSAGEBROKER_AZURESB_SUBSCRIPTION_NAME , subcriptionName } ,
82+ { PropertyConstants . MESSAGEBROKER_AZURESB_FULLYQUALIFIEDNAMESPACE , fullyQualifiedNamespace }
83+ } ;
84+
85+ MessageQueue messageQueue = messageBrokerProvider . Connect ( PropertyConstants . AZURESERVICEBUS , properties , out GXBaseCollection < SdtMessages_Message > errorMessagesConnect , out bool successConnect ) ;
86+ errorMessages = errorMessagesConnect ;
87+ success = successConnect ;
88+ return messageQueue ;
89+ }
90+ #endregion
91+
92+ #region Connect using SAS (Shared Access Signatures)
93+ public MessageQueue Connect ( string queueName , string connectionString , out GXBaseCollection < SdtMessages_Message > errorMessages , out bool success )
94+ {
95+ MessageBrokerProvider messageBrokerProvider = new MessageBrokerProvider ( ) ;
96+ GXProperties properties = new GXProperties
97+ {
98+ { PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , queueName } ,
99+ { PropertyConstants . MESSAGEBROKER_AZURESB_CONNECTIONSTRING , connectionString }
100+ } ;
101+
102+ MessageQueue messageQueue = messageBrokerProvider . Connect ( PropertyConstants . AZURESERVICEBUS , properties , out GXBaseCollection < SdtMessages_Message > errorMessagesConnect , out bool successConnect ) ;
103+ errorMessages = errorMessagesConnect ;
104+ success = successConnect ;
105+ return messageQueue ;
106+ }
107+
108+ public MessageQueue Connect ( string topicName , string subcriptionName , string connectionString , out GXBaseCollection < SdtMessages_Message > errorMessages , out bool success )
109+ {
110+ MessageBrokerProvider messageBrokerProvider = new MessageBrokerProvider ( ) ;
111+ GXProperties properties = new GXProperties
112+ {
113+ { PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , topicName } ,
114+ { PropertyConstants . MESSAGEBROKER_AZURESB_SUBSCRIPTION_NAME , subcriptionName } ,
115+ { PropertyConstants . MESSAGEBROKER_AZURESB_CONNECTIONSTRING , connectionString }
116+ } ;
30117
31118 MessageQueue messageQueue = messageBrokerProvider . Connect ( PropertyConstants . AZURESERVICEBUS , properties , out GXBaseCollection < SdtMessages_Message > errorMessagesConnect , out bool successConnect ) ;
32119 errorMessages = errorMessagesConnect ;
@@ -39,15 +126,17 @@ public MessageQueue Connect(string queueName, string connectionString, bool sess
39126 MessageBrokerProvider messageBrokerProvider = new MessageBrokerProvider ( ) ;
40127 ReceiverOptions options = TransformGXUserTypeToReceiverOptions ( receiverOptions ) ;
41128
42- GXProperties properties = new GXProperties ( ) ;
43- properties . Add ( PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , queueName ) ;
44- properties . Add ( PropertyConstants . MESSAGEBROKER_AZURESB_CONNECTIONSTRING , connectionString ) ;
45- properties . Add ( PropertyConstants . SESSION_ENABLED , sessionEnabled . ToString ( ) ) ;
46- properties . Add ( PropertyConstants . RECEIVE_MODE , options . ReceiveMode . ToString ( ) ) ;
47- properties . Add ( PropertyConstants . PREFETCH_COUNT , options . PrefetchCount . ToString ( ) ) ;
48- properties . Add ( PropertyConstants . RECEIVER_IDENTIFIER , options . Identifier ) ;
49- properties . Add ( PropertyConstants . RECEIVER_SESSIONID , options . SessionId ) ;
50- properties . Add ( PropertyConstants . SENDER_IDENTIFIER , senderIdentifier ) ;
129+ GXProperties properties = new GXProperties
130+ {
131+ { PropertyConstants . MESSAGEBROKER_AZURESB_QUEUENAME , queueName } ,
132+ { PropertyConstants . MESSAGEBROKER_AZURESB_CONNECTIONSTRING , connectionString } ,
133+ { PropertyConstants . SESSION_ENABLED , sessionEnabled . ToString ( ) } ,
134+ { PropertyConstants . RECEIVE_MODE , options . ReceiveMode . ToString ( ) } ,
135+ { PropertyConstants . PREFETCH_COUNT , options . PrefetchCount . ToString ( ) } ,
136+ { PropertyConstants . RECEIVER_IDENTIFIER , options . Identifier } ,
137+ { PropertyConstants . RECEIVER_SESSIONID , options . SessionId } ,
138+ { PropertyConstants . SENDER_IDENTIFIER , senderIdentifier }
139+ } ;
51140
52141 MessageQueue messageQueue = messageBrokerProvider . Connect ( PropertyConstants . AZURESERVICEBUS , properties , out GXBaseCollection < SdtMessages_Message > errorMessagesConnect , out bool successConnect ) ;
53142 errorMessages = errorMessagesConnect ;
@@ -77,6 +166,8 @@ public MessageQueue Connect(string topicName, string subcriptionName, string con
77166 return messageQueue ;
78167 }
79168
169+ #endregion
170+
80171 #region Transformation methods
81172 private ReceiverOptions TransformGXUserTypeToReceiverOptions ( GxUserType options )
82173 {
0 commit comments