Skip to content

Commit

Permalink
[ksqlDB.RestApi.Client.ProtoBuf]: upgraded to ksqlDb.RestApi.Client u…
Browse files Browse the repository at this point in the history
…pgraded to v6.0.0
  • Loading branch information
tomasfabian committed May 3, 2024
1 parent 861f5d7 commit 792e097
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ public class ProtoBufQueryStream
{
public static async Task StartAsync()
{
var ksqlDbUrl = @"http://localhost:8088";
var ksqlDbUrl = "http://localhost:8088";

await using var context = new ProtoBufKSqlDbContext(ksqlDbUrl);

var query = context.CreatePushQuery<MovieProto>("movie")
// var query = context.CreateQuery<MovieProto>("movie")
.Where(p => p.Title != "E.T.")
.Where(c => c.Title.ToLower().Contains("hard".ToLower()) || c.Id == 1)
.Select(l => new { Id = l.Id, l.Title, l.Release_Year })
.Select(l => new { l.Id, l.Title, ReleaseYear = l.Release_Year })
.Take(2); // LIMIT 2

var ksql = query.ToQueryString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
</PropertyGroup>

<ItemGroup>
<!-- <PackageReference Include="ksqlDb.RestApi.Client" Version="6.0.0" /> -->
<ProjectReference Include="..\..\ksqlDb.RestApi.Client\ksqlDb.RestApi.Client.csproj" />
<PackageReference Include="ksqlDb.RestApi.Client.ProtoBuf" Version="3.0.0" />
<!-- <ProjectReference Include="..\..\ksqlDb.RestApi.Client.ProtoBuf\ksqlDb.RestApi.Client.ProtoBuf.csproj" /> -->
<PackageReference Include="ksqlDb.RestApi.Client" Version="6.0.0" />
<!-- <ProjectReference Include="..\..\ksqlDb.RestApi.Client\ksqlDb.RestApi.Client.csproj" /> -->
<!-- <PackageReference Include="ksqlDb.RestApi.Client.ProtoBuf" Version="4.0.0" /> -->
<ProjectReference Include="..\..\ksqlDb.RestApi.Client.ProtoBuf\ksqlDb.RestApi.Client.ProtoBuf.csproj" />

<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void CreatePushQuery_Subscribe_KSqlDbProvidersRunWasCalled()
var context = new TestableProtoBufKSqlDbContext<string>(TestParameters.KsqlDbUrl);

//Act
using var subscription = context.CreateQueryStream<string>()
using var subscription = context.CreatePushQuery<string>()
.Subscribe(_ => { });

//Assert
Expand Down
5 changes: 4 additions & 1 deletion ksqlDb.RestApi.Client.ProtoBuf/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# ksqlDB.RestApi.Client.ProtoBuf

# 4.0.0
- ksqlDb.RestApi.Client upgraded to v6.0.0

# 3.0.0
- added **net8.0** TFM
- ksqlDb.RestApi.Client upgraded to 3.3.0
- ksqlDb.RestApi.Client upgraded to v3.3.0

# v2.0.0
Removed not supported **TFM**s:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using ksqlDb.RestApi.Client.FluentAPI.Builders;
using ksqlDB.RestApi.Client.KSql.Query.Context;
using ksqlDB.RestApi.Client.KSql.Query.Options;
using ksqlDB.RestApi.Client.KSql.RestApi;
using ksqlDb.RestApi.Client.ProtoBuf.KSql.RestApi;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
Expand All @@ -11,24 +14,63 @@ namespace ksqlDb.RestApi.Client.ProtoBuf.KSql.Query.Context;

public class ProtoBufKSqlDbContext : KSqlDBContext
{
/// <summary>
/// Initializes a new instance of the ProtoBufKSqlDbContext class with the specified ksqlDB server URL.
/// </summary>
/// <param name="ksqlDbUrl">The URL of the ksqlDB server.</param>
/// <param name="loggerFactory">An optional logger factory to use for logging (defaults to null).</param>
public ProtoBufKSqlDbContext(string ksqlDbUrl, ILoggerFactory? loggerFactory = null)
: this(new KSqlDBContextOptions(ksqlDbUrl), loggerFactory)
{
}

/// <summary>
/// Initializes a new instance of the ProtoBufKSqlDbContext class with the specified ksqlDB server URL.
/// </summary>
/// <param name="ksqlDbUrl">The URL of the ksqlDB server.</param>
/// <param name="modelBuilder">The model builder.</param>
/// <param name="loggerFactory">An optional logger factory to use for logging (defaults to null).</param>
public ProtoBufKSqlDbContext(string ksqlDbUrl, ModelBuilder modelBuilder, ILoggerFactory? loggerFactory = null)
: this(new KSqlDBContextOptions(ksqlDbUrl), modelBuilder, loggerFactory)
{
}

/// <summary>
/// Initializes a new instance of the ProtoBufKSqlDbContext class with the specified context options.
/// </summary>
/// <param name="contextOptions">The options for configuring the KSqlDBContext.</param>
/// <param name="loggerFactory">An optional logger factory to use for logging (defaults to null).</param>
public ProtoBufKSqlDbContext(KSqlDBContextOptions contextOptions, ILoggerFactory? loggerFactory = null)
: base(contextOptions, loggerFactory)
{
KSqlDBQueryContext = new KSqlDBContextQueryDependenciesProvider(contextOptions);
}

#if !NETSTANDARD
/// <summary>
/// Initializes a new instance of the ProtoBufKSqlDbContext class with the specified context options.
/// </summary>
/// <param name="contextOptions">The options for configuring the KSqlDBContext.</param>
/// <param name="modelBuilder">The model builder.</param>
/// <param name="loggerFactory">An optional logger factory to use for logging (defaults to null).</param>
public ProtoBufKSqlDbContext(KSqlDBContextOptions contextOptions, ModelBuilder modelBuilder, ILoggerFactory? loggerFactory = null)
: base(contextOptions, modelBuilder, loggerFactory)
{
}

protected override void OnConfigureServices(IServiceCollection serviceCollection, KSqlDBContextOptions contextOptions)
{
serviceCollection.TryAddScoped<IKSqlDbProvider, KSqlDbQueryStreamProvider>();
switch (contextOptions.EndpointType)
{
case EndpointType.Query:
serviceCollection.TryAddScoped<IKSqlDbProvider, KSqlDbQueryProvider>();
break;
case EndpointType.QueryStream:
serviceCollection.TryAddScoped<IKSqlDbProvider, KSqlDbQueryStreamProvider>();

break;
default:
throw new ArgumentOutOfRangeException(nameof(contextOptions.EndpointType), contextOptions.EndpointType, "Non-exhaustive match");
}

base.OnConfigureServices(serviceCollection, contextOptions);
}
#endif

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
Documentation for the library can be found at https://github.com/tomasfabian/ksqlDB.RestApi.Client-DotNet/blob/main/README.md.
</Description>
<PackageTags>ksql ksqlDB ProtoBuf LINQ .NET csharp push query</PackageTags>
<Version>3.0.0</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<LangVersion>10.0</LangVersion>
<Version>4.0.0</Version>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<LangVersion>12.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageReleaseNotes>https://github.com/tomasfabian/ksqlDB.RestApi.Client-DotNet/blob/main/ksqlDb.RestApi.Client.ProtoBuf/ChangeLog.md</PackageReleaseNotes>
Expand All @@ -24,7 +24,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ksqlDb.RestApi.Client" Version="3.3.0" />
<PackageReference Include="ksqlDb.RestApi.Client" Version="6.0.0" />
<!-- <ProjectReference Include="..\ksqlDb.RestApi.Client\ksqlDb.RestApi.Client.csproj" /> -->
<PackageReference Include="protobuf-net" Version="3.2.0" />
</ItemGroup>
Expand Down

0 comments on commit 792e097

Please sign in to comment.