Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Health checks and configuration #2065

Merged
merged 2 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Brighter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Salutations_MySqlMigrations
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Salutations_SqliteMigrations", "samples\WebAPI_EFCore\Salutations_SqliteMigrations\Salutations_SqliteMigrations.csproj", "{05647D1B-87A3-4440-B468-82866B206E49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paramore.Brighter.ServiceActivator.Extensions.HealthChecks", "src\Paramore.Brighter.ServiceActivator.Extensions.HealthChecks\Paramore.Brighter.ServiceActivator.Extensions.HealthChecks.csproj", "{72763FBA-675A-4784-8A57-E69AD41DC685}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paramore.Brighter.ServiceActivator.Extensions.Diagnostics", "src\Paramore.Brighter.ServiceActivator.Extensions.Diagnostics\Paramore.Brighter.ServiceActivator.Extensions.Diagnostics.csproj", "{72763FBA-675A-4784-8A57-E69AD41DC685}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ProjectReference Include="..\..\..\src\Paramore.Brighter.MsSql\Paramore.Brighter.MsSql.csproj" />
<ProjectReference Include="..\..\..\src\Paramore.Brighter.Outbox.MsSql\Paramore.Brighter.Outbox.MsSql.csproj" />
<ProjectReference Include="..\..\..\src\Paramore.Brighter.ServiceActivator.Extensions.DependencyInjection\Paramore.Brighter.ServiceActivator.Extensions.DependencyInjection.csproj" />
<ProjectReference Include="..\..\..\src\Paramore.Brighter.ServiceActivator.Extensions.HealthChecks\Paramore.Brighter.ServiceActivator.Extensions.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\src\Paramore.Brighter.ServiceActivator.Extensions.Diagnostics\Paramore.Brighter.ServiceActivator.Extensions.Diagnostics.csproj" />
<ProjectReference Include="..\..\..\src\Paramore.Brighter.ServiceActivator.Extensions.Hosting\Paramore.Brighter.ServiceActivator.Extensions.Hosting.csproj" />
<ProjectReference Include="..\Greetings\Greetings.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/ASBTaskQueue/GreetingsWorker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using Paramore.Brighter.Outbox.MsSql;
using Paramore.Brighter.ServiceActivator;
using Paramore.Brighter.ServiceActivator.Extensions.DependencyInjection;
using Paramore.Brighter.ServiceActivator.Extensions.HealthChecks;
using Paramore.Brighter.ServiceActivator.Extensions.Diagnostics.HealthChecks;
using Paramore.Brighter.ServiceActivator.Extensions.Hosting;

var builder = WebApplication.CreateBuilder(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ public class SqsSubscription : Subscription
/// <param name="tags">Resource tags to be added to the queue</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="rawMessageDelivery">The indication of Raw Message Delivery setting is enabled or disabled</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public SqsSubscription(Type dataType,
SubscriptionName name = null,
ChannelName channelName = null,
Expand All @@ -138,9 +140,11 @@ public SqsSubscription(Type dataType,
SnsAttributes snsAttributes = null,
Dictionary<string,string> tags = null,
OnMissingChannel makeChannels = OnMissingChannel.Create,
bool rawMessageDelivery = true
bool rawMessageDelivery = true,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000
)
: base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMs, requeueCount, requeueDelayInMs, unacceptableMessageLimit, runAsync, channelFactory, makeChannels)
: base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMs, requeueCount, requeueDelayInMs, unacceptableMessageLimit, runAsync, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
{
LockTimeout = lockTimeout;
DelaySeconds = delaySeconds;
Expand Down Expand Up @@ -189,6 +193,8 @@ public class SqsSubscription<T> : SqsSubscription where T : IRequest
/// <param name="tags">Resource tags to be added to the queue</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="rawMessageDelivery">The indication of Raw Message Delivery setting is enabled or disabled</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public SqsSubscription(SubscriptionName name = null,
ChannelName channelName = null,
RoutingKey routingKey = null,
Expand All @@ -211,12 +217,14 @@ public SqsSubscription(SubscriptionName name = null,
SnsAttributes snsAttributes = null,
Dictionary<string,string> tags = null,
OnMissingChannel makeChannels = OnMissingChannel.Create,
bool rawMessageDelivery = true
bool rawMessageDelivery = true,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000
)
: base(typeof(T), name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMs, pollDelayInMs,
noWorkPauseInMs, requeueCount, requeueDelayInMs, unacceptableMessageLimit, runAsync, channelFactory,
lockTimeout, delaySeconds, messageRetentionPeriod,findTopicBy, iAmPolicy,redrivePolicy,
snsAttributes, tags, makeChannels, rawMessageDelivery)
snsAttributes, tags, makeChannels, rawMessageDelivery, emptyChannelDelay, channelFailureDelay)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class AzureServiceBusSubscription : Subscription
/// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="subscriptionConfiguration">The configuration options for the subscriptions.</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public AzureServiceBusSubscription(
Type dataType,
SubscriptionName name = null,
Expand All @@ -40,9 +42,11 @@ public AzureServiceBusSubscription(
bool isAsync = false,
IAmAChannelFactory channelFactory = null,
OnMissingChannel makeChannels = OnMissingChannel.Create,
AzureServiceBusSubscriptionConfiguration subscriptionConfiguration = null)
AzureServiceBusSubscriptionConfiguration subscriptionConfiguration = null,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000)
: base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMs, unacceptableMessageLimit, isAsync, channelFactory,
makeChannels)
makeChannels, emptyChannelDelay, channelFailureDelay)
{
Configuration = subscriptionConfiguration ?? new AzureServiceBusSubscriptionConfiguration();
}
Expand Down Expand Up @@ -70,6 +74,8 @@ public class AzureServiceBusSubscription<T> : AzureServiceBusSubscription where
/// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="subscriptionConfiguration">The configuration options for the subscriptions.</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public AzureServiceBusSubscription(
SubscriptionName name = null,
ChannelName channelName = null,
Expand All @@ -83,10 +89,12 @@ public AzureServiceBusSubscription(
bool isAsync = false,
IAmAChannelFactory channelFactory = null,
OnMissingChannel makeChannels = OnMissingChannel.Create,
AzureServiceBusSubscriptionConfiguration subscriptionConfiguration = null)
AzureServiceBusSubscriptionConfiguration subscriptionConfiguration = null,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000)
: base(typeof(T), name, channelName, routingKey, bufferSize, noOfPerformers,
timeoutInMilliseconds, requeueCount, requeueDelayInMs, unacceptableMessageLimit,
isAsync, channelFactory, makeChannels, subscriptionConfiguration)
isAsync, channelFactory, makeChannels, subscriptionConfiguration, emptyChannelDelay, channelFailureDelay)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public class KafkaSubscription : Subscription
/// <param name="numOfPartitions">How many partitions should this topic have - used if we create the topic</param>
/// <param name="replicationFactor">How many copies of each partition should we have across our broker's nodes - used if we create the topic</param> /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public KafkaSubscription (
Type dataType,
SubscriptionName name = null,
Expand All @@ -141,9 +143,11 @@ public KafkaSubscription (
int numOfPartitions = 1,
short replicationFactor = 1,
IAmAChannelFactory channelFactory = null,
OnMissingChannel makeChannels = OnMissingChannel.Create)
OnMissingChannel makeChannels = OnMissingChannel.Create,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000)
: base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount,
requeueDelayInMilliseconds, unacceptableMessageLimit, isAsync, channelFactory, makeChannels)
requeueDelayInMilliseconds, unacceptableMessageLimit, isAsync, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
{
CommitBatchSize = commitBatchSize;
GroupId = groupId;
Expand Down Expand Up @@ -183,6 +187,8 @@ public class KafkaSubscription<T> : KafkaSubscription where T : IRequest
/// <param name="replicationFactor">How many copies of each partition should we have across our broker's nodes - used if we create the topic</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public KafkaSubscription(
SubscriptionName name = null,
ChannelName channelName = null,
Expand All @@ -204,11 +210,13 @@ public KafkaSubscription(
int numOfPartitions = 1,
short replicationFactor = 1,
IAmAChannelFactory channelFactory = null,
OnMissingChannel makeChannels = OnMissingChannel.Create)
OnMissingChannel makeChannels = OnMissingChannel.Create,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000)
: base(typeof(T), name, channelName, routingKey, groupId, bufferSize, noOfPerformers, timeoutInMilliseconds,
requeueCount, requeueDelayInMilliseconds, unacceptableMessageLimit, offsetDefault, commitBatchSize,
sessionTimeoutMs, maxPollIntervalMs, sweepUncommittedOffsetsIntervalMs, isolationLevel, isAsync,
numOfPartitions, replicationFactor, channelFactory, makeChannels)
numOfPartitions, replicationFactor, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class MsSqlSubscription : Subscription
/// <param name="runAsync">Is this channel read asynchronously</param>
/// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public MsSqlSubscription(
Type dataType,
SubscriptionName name = null,
Expand All @@ -57,9 +59,11 @@ public MsSqlSubscription(
int unacceptableMessageLimit = 0,
bool runAsync = false,
IAmAChannelFactory channelFactory = null,
OnMissingChannel makeChannels = OnMissingChannel.Create)
OnMissingChannel makeChannels = OnMissingChannel.Create,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000)
: base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount,
requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels)
requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
{
}
}
Expand All @@ -81,6 +85,8 @@ public class MsSqlSubscription<T> : MsSqlSubscription where T : IRequest
/// <param name="runAsync">Is this channel read asynchronously</param>
/// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public MsSqlSubscription(
SubscriptionName name = null,
ChannelName channelName = null,
Expand All @@ -93,9 +99,11 @@ public MsSqlSubscription(
int unacceptableMessageLimit = 0,
bool runAsync = false,
IAmAChannelFactory channelFactory = null,
OnMissingChannel makeChannels = OnMissingChannel.Create)
OnMissingChannel makeChannels = OnMissingChannel.Create,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000)
: base(typeof(T), name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount,
requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels)
requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
{
}

Expand Down
16 changes: 12 additions & 4 deletions src/Paramore.Brighter.MessagingGateway.RMQ/RmqSubscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public class RmqSubscription : Subscription
/// <param name="deadLetterRoutingKey">The routing key for dead letters</param>
/// <param name="ttl">Time to live in ms of a message on a queue; null (the default) is inifinite</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public RmqSubscription(
Type dataType,
SubscriptionName name = null,
Expand All @@ -105,8 +107,10 @@ public RmqSubscription(
ChannelName deadLetterChannelName = null,
string deadLetterRoutingKey = null,
int? ttl = null,
OnMissingChannel makeChannels = OnMissingChannel.Create)
: base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels)
OnMissingChannel makeChannels = OnMissingChannel.Create,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000)
: base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
{
DeadLetterRoutingKey = deadLetterRoutingKey;
DeadLetterChannelName = deadLetterChannelName;
Expand Down Expand Up @@ -139,6 +143,8 @@ public class RmqSubscription<T> : RmqSubscription where T : IRequest
/// <param name="deadLetterRoutingKey">The routing key for dead letters</param>
/// <param name="ttl">Time to live in ms of a message on a queue; null (the default) is inifinite</param>
/// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
/// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
/// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
public RmqSubscription(SubscriptionName name = null,
ChannelName channelName = null,
RoutingKey routingKey = null,
Expand All @@ -155,9 +161,11 @@ public RmqSubscription(SubscriptionName name = null,
ChannelName deadLetterChannelName = null,
string deadLetterRoutingKey = null,
int? ttl = null,
OnMissingChannel makeChannels = OnMissingChannel.Create)
OnMissingChannel makeChannels = OnMissingChannel.Create,
int emptyChannelDelay = 500,
int channelFailureDelay = 1000)
: base(typeof(T), name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMilliseconds,
unacceptableMessageLimit, isDurable, runAsync, channelFactory, highAvailability, deadLetterChannelName, deadLetterRoutingKey, ttl, makeChannels)
unacceptableMessageLimit, isDurable, runAsync, channelFactory, highAvailability, deadLetterChannelName, deadLetterRoutingKey, ttl, makeChannels, emptyChannelDelay, channelFailureDelay)
{ }

}
Expand Down
Loading