tomasfabian / ksqlDB.RestApi.Client-DotNet

ksqlDb.RestApi.Client is a C# LINQ-enabled client API for issuing and consuming ksqlDB push and pull queries and executing statements.
MIT License
93 stars 24 forks source link

Distinguish the configuration for push and pull queries using KSqlDbContextOptions #77

Closed tomasfabian closed 2 months ago

tomasfabian commented 2 months ago

Currently, both pull and push queries share the following KSqlDbContextOptions for configuring the query and query-stream endpoints:

contextOptions.QueryParameters;
contextOptions.QueryStreamParameters;

Additionally, they are configurable through KSqlDbContextOptionsBuilder:

new KSqlDbContextOptionsBuilder()
      .UseKSqlDb(ksqlDbUrl)
      .SetupQueryStream(options =>
      {
      })
      .SetupQuery(options =>
      {
      });

The new API should introduce distinct parameters specifically tailored for pull queries. This modification will result in a breaking change.

contextOptions.PullQueryParameters;
new KSqlDbContextOptionsBuilder()
      .UseKSqlDb(ksqlDbUrl)
      .SetupPullQuery(options =>
      {
      });

Remove SetupQuery from KSqlDbContextOptionsBuilder, and unify it with SetupQueryStream.

tomasfabian commented 2 months ago

Hello @jbkuczma, I've separated the configuration for pull and push queries as we discussed in issue #75. Please try it out when you have some time.

To install the required package, use the following command:

dotnet add package ksqlDb.RestApi.Client --version 6.0.0-rc.2

The PR is available here #78

tomasfabian commented 2 months ago

After merging SetupQuery with SetupQueryStream and introducing SetupPullQuery, it would be appropriate to rename SetupQueryStream to SetupPushQuery to maintain consistency in naming conventions at the cost of yet another breaking change. Alternatively, we could pluralize the functions to SetupPushQueries and SetupPullQueries. I'd like to hear your thoughts on this approach @jbkuczma. Thank you in advance!

jbkuczma commented 2 months ago

I do like the idea of SetupPullQuery and SetupPushQuery for consistency purposes. I am indifferent on pluralizing the function names.

tomasfabian commented 2 months ago

Thank you for your feedback @jbkuczma. I also decided to rename IKsqlDbContext.CreateQueryStream to IKsqlDbContext.CreatePushQuery to be consistent with IKsqlDbContext.CreatePullQuery. I released a new version 6.0.0.