Skip to content

Commit

Permalink
Clean up code quality issues (#14)
Browse files Browse the repository at this point in the history
get rid of warnings and other code qualitity issues
  • Loading branch information
fw2568 authored Apr 13, 2024
1 parent 4ed6724 commit 86d4134
Show file tree
Hide file tree
Showing 78 changed files with 1,014 additions and 1,084 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,50 @@
using Rebus.Subscriptions;
using Rebus.Timeouts;

namespace Dbosoft.Rebus.Configuration
namespace Dbosoft.Rebus.Configuration;

public static class RebusConfigurerExtensions
{
public static class RebusConfigurerExtensions

public static RebusConfigurer DataBus(this RebusConfigurer rebusConfigurer,
IRebusConfigurer<IDataBusStorage> configurer)
{
rebusConfigurer.DataBus(configurer.Configure);
return rebusConfigurer;
}

public static RebusConfigurer Timeouts(this RebusConfigurer rebusConfigurer,
IRebusConfigurer<ITimeoutManager> configurer)
{
rebusConfigurer.Timeouts(configurer.Configure);
return rebusConfigurer;
}

public static RebusConfigurer Subscriptions(this RebusConfigurer rebusConfigurer,
IRebusConfigurer<ISubscriptionStorage> configurer)
{
rebusConfigurer.Subscriptions(configurer.Configure);
return rebusConfigurer;
}

public static RebusConfigurer OneWayTransport(this RebusConfigurer rebusConfigurer,
IRebusTransportConfigurer configurer)
{
rebusConfigurer.Transport(configurer.ConfigureAsOneWayClient);
return rebusConfigurer;
}

public static RebusConfigurer DataBus(this RebusConfigurer rebusConfigurer,
IRebusConfigurer<IDataBusStorage> configurer)
{
rebusConfigurer.DataBus(configurer.Configure);
return rebusConfigurer;
}

public static RebusConfigurer Timeouts(this RebusConfigurer rebusConfigurer,
IRebusConfigurer<ITimeoutManager> configurer)
{
rebusConfigurer.Timeouts(configurer.Configure);
return rebusConfigurer;
}

public static RebusConfigurer Subscriptions(this RebusConfigurer rebusConfigurer,
IRebusConfigurer<ISubscriptionStorage> configurer)
{
rebusConfigurer.Subscriptions(configurer.Configure);
return rebusConfigurer;
}

public static RebusConfigurer OneWayTransport(this RebusConfigurer rebusConfigurer,
IRebusTransportConfigurer configurer)
{
rebusConfigurer.Transport(configurer.ConfigureAsOneWayClient);
return rebusConfigurer;
}

public static RebusConfigurer Transport(this RebusConfigurer rebusConfigurer,
IRebusTransportConfigurer configurer, string queueName)
{
rebusConfigurer.Transport(cfg => configurer.Configure(cfg, queueName));
return rebusConfigurer;
}

public static RebusConfigurer Sagas(this RebusConfigurer rebusConfigurer,
IRebusConfigurer<ISagaStorage> configurer)
{
rebusConfigurer.Sagas(configurer.Configure);
return rebusConfigurer;
}
public static RebusConfigurer Transport(this RebusConfigurer rebusConfigurer,
IRebusTransportConfigurer configurer, string queueName)
{
rebusConfigurer.Transport(cfg => configurer.Configure(cfg, queueName));
return rebusConfigurer;
}

public static RebusConfigurer Sagas(this RebusConfigurer rebusConfigurer,
IRebusConfigurer<ISagaStorage> configurer)
{
rebusConfigurer.Sagas(configurer.Configure);
return rebusConfigurer;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public ChainedRebusSelector(IConfiguration configuration, ILogger log, IEnumerab
foreach (var configType in selector.AcceptedConfigTypes)
{
List<GenericRebusSelectorBase<TConfigure>> list;
if (_selectors.ContainsKey(configType))
if (_selectors.TryGetValue(configType, out var foundSelectors))
{
list = _selectors[configType];
list = foundSelectors;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public ChainedTransportSelector(IConfiguration configuration, ILogger log,
foreach (var configType in selector.AcceptedConfigTypes)
{
List<RebusTransportSelectorBase> list;
if (_selectors.ContainsKey(configType))
if (_selectors.TryGetValue(configType, out var foundSelectors))
{
list = _selectors[configType];
list = foundSelectors;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using Microsoft.Extensions.Configuration;
using JetBrains.Annotations;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Rebus.Config;
using Rebus.DataBus;

namespace Dbosoft.Rebus.Configuration;

[PublicAPI]
public class SqlServerDataBusSelector : SqlServerSelectorBase<IDataBusStorage>
{
private readonly IOptions<SqlServerDataBusOptions> _options;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using Microsoft.Extensions.Configuration;
using JetBrains.Annotations;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Rebus.Config;
using Rebus.Sagas;

namespace Dbosoft.Rebus.Configuration;

[PublicAPI]
public class SqlServerSagaStoreSelector : SqlServerSelectorBase<ISagaStorage>
{
private readonly IOptions<SqlServerSagaStoreOptions> _options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Rebus.Config;
using Options = Rebus.Config.Options;

namespace Dbosoft.Rebus.Configuration;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using Microsoft.Extensions.Configuration;
using JetBrains.Annotations;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Rebus.Config;
using Rebus.Subscriptions;

namespace Dbosoft.Rebus.Configuration;

[PublicAPI]
public class SqlServerSubscriptionsSelector : SqlServerSelectorBase<ISubscriptionStorage>
{
private readonly IOptions<SqlServerSubscriptionsStoreOptions> _options;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using Microsoft.Extensions.Configuration;
using JetBrains.Annotations;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Rebus.Config;
using Rebus.Timeouts;

namespace Dbosoft.Rebus.Configuration;

[PublicAPI]
public class SqlServerTimeoutsSelector: SqlServerSelectorBase<ITimeoutManager>
{
private readonly IOptions<SqlServerTimeoutsStoreOptions> _options;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#nullable enable

using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Dbosoft.Rebus.Operations
namespace Dbosoft.Rebus.Operations;

[PublicAPI]
public interface IOperationDispatcher
{
public interface IOperationDispatcher
{
ValueTask<IOperation?> StartNew<T>(object? additionalData = default, IDictionary<string,string>? additionalHeaders = null) where T : class, new();
ValueTask<IOperation?> StartNew(Type commandType, object? additionalData = default, IDictionary<string,string>? additionalHeaders = null);
ValueTask<IOperation?> StartNew(object operationCommand, object? additionalData = default, IDictionary<string,string>? additionalHeaders = null);
ValueTask<IOperation?> StartNew<T>(object? additionalData = default, IDictionary<string,string>? additionalHeaders = null) where T : class, new();
ValueTask<IOperation?> StartNew(Type commandType, object? additionalData = default, IDictionary<string,string>? additionalHeaders = null);
ValueTask<IOperation?> StartNew(object operationCommand, object? additionalData = default, IDictionary<string,string>? additionalHeaders = null);

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using JetBrains.Annotations;
using System;

namespace Dbosoft.Rebus.Operations;

[PublicAPI]
public interface IOperationLogEntry
{
string Message { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
#nullable enable

using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Dbosoft.Rebus.Operations
{
public interface IOperationTaskDispatcher
{
ValueTask<IOperationTask?> StartNew<T>(Guid operationId, Guid initiatingTaskId,
object? additionalData = default, IDictionary<string,string>? additionalHeaders = null) where T : class, new();
namespace Dbosoft.Rebus.Operations;

ValueTask<IOperationTask?> StartNew(Guid operationId, Guid initiatingTaskId, Type operationCommandType,
object? additionalData = default, IDictionary<string,string>? additionalHeaders = null);
public interface IOperationTaskDispatcher
{
ValueTask<IOperationTask?> StartNew<T>(Guid operationId, Guid initiatingTaskId,
object? additionalData = default, IDictionary<string,string>? additionalHeaders = null) where T : class, new();

ValueTask<IOperationTask?> StartNew(Guid operationId, Guid initiatingTaskId, object command
, object? additionalData = default, IDictionary<string,string>? additionalHeaders = null);
ValueTask<IOperationTask?> StartNew(Guid operationId, Guid initiatingTaskId, Type operationCommandType,
object? additionalData = default, IDictionary<string,string>? additionalHeaders = null);

}
ValueTask<IOperationTask?> StartNew(Guid operationId, Guid initiatingTaskId, object command
, object? additionalData = default, IDictionary<string,string>? additionalHeaders = null);

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JetBrains.Annotations;

namespace Dbosoft.Rebus.Operations;

[PublicAPI]
public interface ITaskMessaging
{
Task FailTask(IOperationTaskMessage message, string errorMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Dbosoft.Rebus.Operations.Workflow;

#nullable enable
public interface IOperationManager
{
ValueTask<IOperation?> GetByIdAsync(Guid operationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Dbosoft.Rebus.Operations.Events;
using JetBrains.Annotations;

namespace Dbosoft.Rebus.Operations.Workflow;

[PublicAPI]
public interface IOperationMessaging
{
Task DispatchTaskMessage(object command, IOperationTask task, IDictionary<string,string>? additionalHeaders = null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

namespace Dbosoft.Rebus.Operations.Workflow;

#nullable enable

public interface IOperationTaskManager
{
ValueTask<IOperationTask?> GetByIdAsync(Guid taskId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
namespace Dbosoft.Rebus.Operations.Workflow;
namespace Dbosoft.Rebus.Operations.Workflow;

public interface IWorkflow
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Dbosoft.Rebus.Operations.Workflow;
using Rebus.Bus;

namespace Dbosoft.Rebus.Operations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

namespace Dbosoft.Rebus.Operations;

#nullable enable

public class DefaultOperationDispatcher : OperationDispatcherBase
{
private readonly IOperationManager _operationManager;
Expand Down
Loading

0 comments on commit 86d4134

Please sign in to comment.