Skip to content

Commit 138732c

Browse files
committed
It's optional to send connectionstring or fullynamespace.
1 parent d283d1d commit 138732c

File tree

2 files changed

+21
-25
lines changed

2 files changed

+21
-25
lines changed

dotnet/src/dotnetcore/Providers/Messaging/GXMessageBroker/MessageBrokerProvider.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace GeneXus.Messaging.Common
1111
[GXApi]
1212
public class MessageBrokerProvider : MessageQueue
1313
{
14-
static readonly ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
14+
static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
1515
private static GXService providerService;
1616
public MessageBrokerProvider()
1717
{
@@ -64,7 +64,7 @@ public MessageQueue Connect(string providerTypeName, GXProperties properties, ou
6464
success = true;
6565
return (messageQueue);
6666
}
67-
private static void Preprocess(String name, GXProperties properties)
67+
private static void Preprocess(string name, GXProperties properties)
6868
{
6969
string className;
7070

@@ -75,6 +75,7 @@ private static void Preprocess(String name, GXProperties properties)
7575
SetEncryptedProperty(properties, PropertyConstants.MESSAGEBROKER_AZURESB_QUEUENAME);
7676
SetEncryptedProperty(properties, PropertyConstants.MESSAGEBROKER_AZURESB_SUBSCRIPTION_NAME);
7777
SetEncryptedProperty(properties, PropertyConstants.MESSAGEBROKER_AZURESB_CONNECTIONSTRING);
78+
SetEncryptedProperty(properties, PropertyConstants.MESSAGEBROKER_AZURESB_FULLYQUALIFIEDNAMESPACE);
7879
if (string.IsNullOrEmpty(providerService.ClassName) || !providerService.ClassName.Contains(className))
7980
{
8081
providerService.ClassName = PropertyConstants.AZURE_SB_PROVIDER_CLASSNAME;
@@ -84,11 +85,11 @@ private static void Preprocess(String name, GXProperties properties)
8485
throw new SystemException(string.Format("Provider {0} is not supported.", name));
8586
}
8687
}
87-
private static void SetEncryptedProperty(GXProperties properties, String prop)
88+
private static void SetEncryptedProperty(GXProperties properties, string prop)
8889
{
89-
String value = properties.Get(prop);
90+
string value = properties.Get(prop);
9091
if (string.IsNullOrEmpty(value))
91-
value = String.Empty;
92+
value = string.Empty;
9293
value = CryptoImpl.Encrypt(value);
9394
properties.Set(prop, value);
9495
}

dotnet/src/dotnetcore/Providers/Messaging/GXMessageBroker/ServiceSettings.cs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
62
using GeneXus.Encryption;
7-
using GeneXus.Messaging.Common;
83
using GeneXus.Services;
94
using log4net;
105

116
namespace GeneXus.Messaging.Common
127
{
138
public class ServiceSettings
149
{
15-
static readonly ILog logger = log4net.LogManager.GetLogger(typeof(ServiceSettings));
10+
static readonly ILog logger = LogManager.GetLogger(typeof(ServiceSettings));
1611

1712
internal GXService service;
1813
public string serviceNameResolver { get; }
@@ -22,61 +17,61 @@ public ServiceSettings(string serviceNameResolver, string name, GXService gXServ
2217
{
2318
this.serviceNameResolver = serviceNameResolver;
2419
this.name = name;
25-
this.service = gXService;
20+
service = gXService;
2621
}
2722

2823
public string GetEncryptedOptPropertyValue(string propertyName, string alternativePropertyName = null)
2924
{
30-
String value = GetEncryptedPropertyValue(propertyName, alternativePropertyName, null);
25+
string value = GetEncryptedPropertyValue(propertyName, alternativePropertyName, null);
3126
return value;
3227
}
3328
public string GetEncryptedPropertyValue(string propertyName, string alternativePropertyName = null)
3429
{
35-
String value = GetEncryptedPropertyValue(propertyName, alternativePropertyName, null);
30+
string value = GetEncryptedPropertyValue(propertyName, alternativePropertyName, null);
3631
if (value == null)
3732
{
38-
String errorMessage = String.Format($"Service configuration error - Property name {ResolvePropertyName(propertyName)} must be defined");
39-
logger.Fatal(errorMessage);
33+
string errorMessage = string.Format($"Service configuration error - Property name {ResolvePropertyName(propertyName)} must be defined");
34+
GXLogging.Error(logger, errorMessage);
4035
throw new Exception(errorMessage);
4136
}
4237
return value;
4338
}
4439
public string GetEncryptedPropertyValue(string propertyName, string alternativePropertyName, string defaultValue)
4540
{
46-
String value = GetPropertyValue(propertyName, alternativePropertyName, defaultValue);
47-
if (!String.IsNullOrEmpty(value))
41+
string value = GetPropertyValue(propertyName, alternativePropertyName, defaultValue);
42+
if (!string.IsNullOrEmpty(value))
4843
{
4944
try
5045
{
51-
string ret = String.Empty;
46+
string ret = string.Empty;
5247
if (CryptoImpl.Decrypt(ref ret, value))
5348
{
5449
value = ret;
5550
}
5651
}
5752
catch (Exception)
5853
{
59-
logger.Warn($"Could not decrypt property name: {ResolvePropertyName(propertyName)}");
54+
GXLogging.Warn(logger, $"Could not decrypt property name: {ResolvePropertyName(propertyName)}");
6055
}
6156
}
6257
return value;
6358
}
6459

6560
internal string GetPropertyValue(string propertyName, string alternativePropertyName = null)
6661
{
67-
String value = GetPropertyValue(propertyName, alternativePropertyName, null);
62+
string value = GetPropertyValue(propertyName, alternativePropertyName, null);
6863
if (value == null)
6964
{
70-
String errorMessage = String.Format($"Service configuration error - Property name {ResolvePropertyName(propertyName)} must be defined");
71-
logger.Fatal(errorMessage);
65+
string errorMessage = string.Format($"Service configuration error - Property name {ResolvePropertyName(propertyName)} must be defined");
66+
GXLogging.Error(logger,errorMessage);
7267
throw new Exception(errorMessage);
7368
}
7469
return value;
7570
}
7671

7772
internal string GetPropertyValue(string propertyName, string alternativePropertyName, string defaultValue)
7873
{
79-
String value = null;
74+
string value = null;
8075
value = string.IsNullOrEmpty(value) ? GetPropertyValueImpl(ResolvePropertyName(propertyName)) : value;
8176
value = string.IsNullOrEmpty(value) ? GetPropertyValueImpl(propertyName) : value;
8277
value = string.IsNullOrEmpty(value) ? GetPropertyValueImpl(alternativePropertyName) : value;
@@ -86,7 +81,7 @@ internal string GetPropertyValue(string propertyName, string alternativeProperty
8681

8782
internal string GetPropertyValueImpl(string propertyName)
8883
{
89-
String value = null;
84+
string value = null;
9085
if (!string.IsNullOrEmpty(propertyName))
9186
{
9287
value = Environment.GetEnvironmentVariable(propertyName);

0 commit comments

Comments
 (0)