File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
src/InEngine.Core/Queuing/Clients Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,20 @@ public class RabbitMQClient : IQueueClient, IDisposable
2323 public bool UseCompression { get ; set ; }
2424 IConnection _connection ;
2525 public IConnection Connection { get {
26- if ( _connection == null )
27- _connection = new ConnectionFactory ( ) {
26+ if ( _connection == null ) {
27+ var factory = new ConnectionFactory ( ) {
2828 HostName = ClientSettings . Host ,
2929 Port = ClientSettings . Port ,
30- UserName = ClientSettings . Username ,
31- Password = ClientSettings . Password ,
32- AutomaticRecoveryEnabled = true
33- } . CreateConnection ( ) ;
30+ AutomaticRecoveryEnabled = true
31+ } ;
32+ if ( ! string . IsNullOrWhiteSpace ( ClientSettings . Username ) &&
33+ ! string . IsNullOrWhiteSpace ( ClientSettings . Password ) ) {
34+ factory . UserName = ClientSettings . Username ;
35+ factory . Password = ClientSettings . Password ;
36+ }
37+
38+ _connection = factory . CreateConnection ( ) ;
39+ }
3440 return _connection ;
3541 }
3642 }
You can’t perform that action at this time.
0 commit comments