Skip to content
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 .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
run: dotnet build -c Release

- name: Tests
run: dotnet test -c Release --no-restore --no-build --logger GitHubActions
run: dotnet test -c Release --no-restore --no-build --logger GitHubActions
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>

<!-- The .NET Version used in all projects -->
<BrighterTargetFrameworks>netstandard2.0;net8.0;net9.0</BrighterTargetFrameworks>
<BrighterFrameworkAndCoreTargetFrameworks>net472;net8.0;net9.0</BrighterFrameworkAndCoreTargetFrameworks>
<BrighterCoreTargetFrameworks>net8.0;net9.0</BrighterCoreTargetFrameworks>
<BrighterTargetFrameworks>netstandard2.0;net8.0;net9.0;net10.0</BrighterTargetFrameworks>
<BrighterFrameworkAndCoreTargetFrameworks>net472;net8.0;net9.0;net10.0</BrighterFrameworkAndCoreTargetFrameworks>
<BrighterCoreTargetFrameworks>net8.0;net9.0;net10.0</BrighterCoreTargetFrameworks>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AssemblyOriginatorKeyFile>../../FluentBrighter.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<BrighterVersion>10.0.5</BrighterVersion>
<BrighterVersion>[10.0.0, 11.0.0)</BrighterVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
Expand Down Expand Up @@ -54,7 +54,7 @@
<PackageVersion Include="Paramore.Brighter.Transformers.AWS.V4" Version="$(BrighterVersion)" />
<PackageVersion Include="Paramore.Brighter.Transformers.Gcp" Version="$(BrighterVersion)" />
<PackageVersion Include="Paramore.Brighter.Transformers.MongoGridFS" Version="$(BrighterVersion)" />
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageVersion Include="Serilog.AspNetCore" Version="10.0.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{

description = ".NET 9 Development Environment";
description = ".NET 10 Development Environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
Expand All @@ -18,7 +18,7 @@
};

# Define the .NET SDK version you want to use
dotnetSdk = pkgs.dotnetCorePackages.sdk_9_0-bin;
dotnetSdk = pkgs.dotnetCorePackages.sdk_10_0-bin;
in
{
devShells.default = pkgs.mkShell {
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.102",
"version": "10.0.100",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion samples/AwsTaskQueue/AwsTaskQueue.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/GcpSample/GcpSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/KafkaSample/KafkaSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/MongoDbSample/MongoDbSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/PostgreFullSample/PostgreFullSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/RedisSample/RedisSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/RmqTaskQueue/RmqTaskQueue.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/RocketMqSample/RocketMqSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/SqlServerSample/SqlServerSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System;

using Fluent.Brighter.GoogleCloud;

using Paramore.Brighter;
using Paramore.Brighter.Firestore;
using Paramore.Brighter.Inbox.Firestore;
using Paramore.Brighter.Inbox.Spanner;
using Paramore.Brighter.MessagingGateway.GcpPubSub;

using SpannerInboxBuilder = Fluent.Brighter.GoogleCloud.SpannerInboxBuilder;

namespace Fluent.Brighter;
Expand All @@ -23,48 +20,59 @@ public static class ConsumerBuilderExtensions
/// <param name="builder">The consumer builder instance.</param>
/// <param name="subscription">The configured <see cref="GcpPubSubSubscription"/> to add.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder AddPubSubSubscription(this ConsumerBuilder builder, GcpPubSubSubscription subscription)
public static ConsumerBuilder AddPubSubSubscription(
this ConsumerBuilder builder,
GcpPubSubSubscription subscription
)
{
return builder.AddSubscription(subscription);
}

/// <summary>
/// Adds a Google Cloud Pub/Sub subscription to the consumer builder using a configuration action.
/// </summary>
/// <param name="builder">The consumer builder instance.</param>
/// <param name="configure">An action to configure the <see cref="GcpPubSubSubscriptionBuilder"/>.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder AddPubSubSubscription(this ConsumerBuilder builder,
Action<GcpPubSubSubscriptionBuilder> configure)
public static ConsumerBuilder AddPubSubSubscription(
this ConsumerBuilder builder,
Action<GcpPubSubSubscriptionBuilder> configure
)
{
var subscription = new GcpPubSubSubscriptionBuilder();
configure(subscription);
return builder.AddSubscription(subscription.Build());
}

/// <summary>
/// Adds a Google Cloud Pub/Sub subscription to the consumer builder with a strongly-typed request using a configuration action.
/// </summary>
/// <typeparam name="TRequest">The type of request that this subscription handles.</typeparam>
/// <param name="builder">The consumer builder instance.</param>
/// <param name="configure">An action to configure the <see cref="GcpPubSubSubscriptionBuilder"/>.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder AddPubSubSubscription<TRequest>(this ConsumerBuilder builder, Action<GcpPubSubSubscriptionBuilder> configure)
public static ConsumerBuilder AddPubSubSubscription<TRequest>(
this ConsumerBuilder builder,
Action<GcpPubSubSubscriptionBuilder> configure
)
where TRequest : class, IRequest
{
var subscription = new GcpPubSubSubscriptionBuilder();
subscription.SetDataType(typeof(TRequest));
configure(subscription);
return builder.AddSubscription(subscription.Build());
}

/// <summary>
/// Adds a Google Cloud Pub/Sub channel factory to the consumer builder.
/// </summary>
/// <param name="builder">The consumer builder instance.</param>
/// <param name="configure">An action to configure the <see cref="GcpMessagingGatewayConnectionBuilder"/>.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder AddPubSubChannelFactory(this ConsumerBuilder builder, Action<GcpMessagingGatewayConnectionBuilder> configure)
public static ConsumerBuilder AddPubSubChannelFactory(
this ConsumerBuilder builder,
Action<GcpMessagingGatewayConnectionBuilder> configure
)
{
var subscription = new GcpMessagingGatewayConnectionBuilder();
configure(subscription);
Expand All @@ -77,76 +85,92 @@ public static ConsumerBuilder AddPubSubChannelFactory(this ConsumerBuilder build
/// <param name="builder">The consumer builder instance.</param>
/// <param name="configure">An action to configure the <see cref="FirestoreInboxBuilder"/>.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder UseFirestoreInbox(this ConsumerBuilder builder,
Action<FirestoreInboxBuilder> configure)
public static ConsumerBuilder UseFirestoreInbox(
this ConsumerBuilder builder,
Action<FirestoreInboxBuilder> configure
)
{
var configuration = new FirestoreInboxBuilder();
configure(configuration);
return builder.UseFirestoreInbox(configuration.Build());
}

/// <summary>
/// Configures the consumer to use Google Cloud Firestore as the inbox storage using an existing gateway connection.
/// </summary>
/// <param name="builder">The consumer builder instance.</param>
/// <param name="connection">The <see cref="GcpMessagingGatewayConnection"/> containing credentials and project information.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder UseFirestoreInbox(this ConsumerBuilder builder, GcpMessagingGatewayConnection connection)
public static ConsumerBuilder UseFirestoreInbox(
this ConsumerBuilder builder,
GcpMessagingGatewayConnection connection
)
{
return builder.UseFirestoreInbox(cfg => cfg
.SetConfiguration(c => c
.SetCredential(connection.Credential)
.SetProjectId(connection.ProjectId)
.SetInbox(new FirestoreCollection{ Name = "inbox"})));
return builder.UseFirestoreInbox(cfg =>
cfg.SetConfiguration(c =>
c.SetCredential(connection.Credential)
.SetProjectId(connection.ProjectId)
.SetInbox(new FirestoreCollection { Name = "inbox" })
)
);
}

/// <summary>
/// Configures the consumer to use Google Cloud Firestore as the inbox storage with a pre-configured inbox instance.
/// </summary>
/// <param name="builder">The consumer builder instance.</param>
/// <param name="inbox">The configured <see cref="FirestoreInbox"/> instance.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder UseFirestoreInbox(this ConsumerBuilder builder, FirestoreInbox inbox)
public static ConsumerBuilder UseFirestoreInbox(
this ConsumerBuilder builder,
FirestoreInbox inbox
)
{
return builder.SetInbox(cfg => cfg.SetInbox(inbox));
}

/// <summary>
/// Configures the consumer to use Google Cloud Spanner as the inbox storage.
/// </summary>
/// <param name="builder">The consumer builder instance.</param>
/// <param name="configure">An action to configure the <see cref="SpannerInboxBuilder"/>.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder UseSpannerInbox(this ConsumerBuilder builder,
Action<SpannerInboxBuilder> configure)
public static ConsumerBuilder UseSpannerInbox(
this ConsumerBuilder builder,
Action<SpannerInboxBuilder> configure
)
{
var configuration = new SpannerInboxBuilder();
configure(configuration);
return builder.UseSpannerInbox(configuration.Build());
}

/// <summary>
/// Configures the consumer to use Google Cloud Spanner as the inbox storage with a connection string.
/// </summary>
/// <param name="builder">The consumer builder instance.</param>
/// <param name="connectionString">The Spanner connection string.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder UseSpannerInbox(this ConsumerBuilder builder, string connectionString)
public static ConsumerBuilder UseSpannerInbox(
this ConsumerBuilder builder,
string connectionString
)
{
return builder.UseSpannerInbox(cfg => cfg
.SetConfiguration(c => c
.SetConnectionString(connectionString)
.SetInboxTableName("inbox")));
return builder.UseSpannerInbox(cfg =>
cfg.SetConfiguration(c =>
c.SetConnectionString(connectionString).SetInboxTableName("inbox")
)
);
}

/// <summary>
/// Configures the consumer to use Google Cloud Spanner as the inbox storage with a pre-configured inbox instance.
/// </summary>
/// <param name="builder">The consumer builder instance.</param>
/// <param name="inbox">The configured <see cref="SpannerInboxAsync"/> instance.</param>
/// <param name="inbox">The configured <see cref="SpannerInbox"/> instance.</param>
/// <returns>The consumer builder for method chaining.</returns>
public static ConsumerBuilder UseSpannerInbox(this ConsumerBuilder builder, SpannerInboxAsync inbox)
public static ConsumerBuilder UseSpannerInbox(this ConsumerBuilder builder, SpannerInbox inbox)
{
return builder.SetInbox(cfg => cfg.SetInbox(inbox));
}
}
}
21 changes: 12 additions & 9 deletions src/Fluent.Brighter.GoogleCloud/SpannerInboxBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Fluent.Brighter.GoogleCloud;

/// <summary>
/// Builder class for creating instances of <see cref="SpannerInboxAsync"/>.
/// Builder class for creating instances of <see cref="SpannerInbox"/>.
/// Provides a fluent API for configuring Google Cloud Spanner inbox storage.
/// </summary>
public sealed class SpannerInboxBuilder
Expand All @@ -29,25 +29,28 @@ public SpannerInboxBuilder SetConfiguration(IAmARelationalDatabaseConfiguration
/// </summary>
/// <param name="connectionProvider">The connection provider to use for managing database connections.</param>
/// <returns>The builder instance for method chaining.</returns>
public SpannerInboxBuilder SetConnectionProvider(IAmARelationalDbConnectionProvider connectionProvider)
public SpannerInboxBuilder SetConnectionProvider(
IAmARelationalDbConnectionProvider connectionProvider
)
{
_connectionProvider = connectionProvider;
return this;
}

/// <summary>
/// Builds a new instance of <see cref="SpannerInboxAsync"/> using the configured settings.
/// Builds a new instance of <see cref="SpannerInbox"/> using the configured settings.
/// </summary>
/// <returns>A configured <see cref="SpannerInboxAsync"/> instance.</returns>
/// <returns>A configured <see cref="SpannerInbox"/> instance.</returns>
/// <exception cref="ConfigurationException">Thrown when configuration is not set.</exception>
internal SpannerInboxAsync Build()
internal SpannerInbox Build()
{
if (_configuration == null)
{
throw new ConfigurationException("Configuration is null");
}

return _connectionProvider == null ? new SpannerInboxAsync(_configuration)
: new SpannerInboxAsync(_configuration, _connectionProvider);

return _connectionProvider == null
? new SpannerInbox(_configuration)
: new SpannerInbox(_configuration, _connectionProvider);
}
}