@@ -26,7 +26,7 @@ public class StreamingClient : IStreamingClient
2626 private readonly ILogger < StreamingClient > _logger ;
2727 private readonly IAuthenticationClientProxy _authenticationClient ;
2828 private readonly SalesforceConfiguration _options ;
29-
29+
3030 // long polling duration
3131 private const int ReadTimeOut = 120 * 1000 ;
3232
@@ -80,16 +80,18 @@ public void SubscribeTopic(string topicName, IMessageListener listener, long rep
8080 {
8181 #region ArgumentNullExeption
8282 if ( null == topicName || ( topicName = topicName . Trim ( ) ) . Length == 0 )
83+ {
8384 throw new ArgumentNullException ( nameof ( topicName ) ) ;
85+ }
86+
8487 if ( null == listener )
88+ {
8589 throw new ArgumentNullException ( nameof ( listener ) ) ;
90+ }
8691 #endregion
8792
8893 var channel = _bayeuxClient . GetChannel ( topicName , replayId ) ;
89- if ( null != channel )
90- {
91- channel . Subscribe ( listener ) ;
92- }
94+ channel ? . Subscribe ( listener ) ;
9395 }
9496
9597 ///<inheritdoc/>
@@ -219,17 +221,15 @@ private void ErrorExtension_ConnectionException(object sender, Exception ex)
219221 /// <param name="message"></param>
220222 private void ErrorExtension_ConnectionError ( object sender , string message )
221223 {
222-
223224 // authentication failure
224225 if ( message . ToLower ( ) == "403::Handshake denied" ||
225226 message . ToLower ( ) == "403:denied_by_security_policy:create_denied" ||
226227 message . ToLower ( ) == "403::unknown client"
227228 )
228229 {
229-
230230 _logger . LogError ( $ "Handled CometD Exception: { message } ") ;
231231 _logger . LogDebug ( $ "Re-authenticating BayeuxClient...") ;
232- // 1. Disconnect
232+ // 1. Disconnect
233233 Disconnect ( ) ;
234234 _logger . LogDebug ( $ "Disconnecting { nameof ( BayeuxClient ) } ...") ;
235235 // 2. try (x) times to re-authenticate
@@ -252,12 +252,19 @@ private void ErrorExtension_ConnectionError(object sender, string message)
252252 private bool _isDisposed = false ;
253253 private ReplayExtension _replayIdExtension ;
254254
255+ /// <summary>
256+ /// Disposing of the resources
257+ /// </summary>
255258 public void Dispose ( )
256259 {
257260 Dispose ( true ) ;
258261 GC . SuppressFinalize ( this ) ;
259262 }
260263
264+ /// <summary>
265+ /// Disposing of the resources
266+ /// </summary>
267+ /// <param name="disposing"></param>
261268 protected virtual void Dispose ( bool disposing )
262269 {
263270 if ( disposing && ! _isDisposed )
@@ -267,6 +274,9 @@ protected virtual void Dispose(bool disposing)
267274 }
268275 }
269276
277+ /// <summary>
278+ /// Destructor
279+ /// </summary>
270280 ~ StreamingClient ( )
271281 {
272282 Dispose ( false ) ;
0 commit comments