Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

kafka-multi-cluster #21

Merged
merged 3 commits into from
May 12, 2021
Merged

kafka-multi-cluster #21

merged 3 commits into from
May 12, 2021

Conversation

SEQUOIIA
Copy link
Member

@SEQUOIIA SEQUOIIA commented May 10, 2021

DON'T MERGE.

@devex-sa
Copy link

CodeScene Delta Analysis Results
Risk 10
Quality Gates OK
Description High Risk (10 where 10 is the highest): The change involves more modules and modified lines of code than 99% of the historic high-risk change sets. The risk is lower since it is an experienced author responsible for 35% of all commits in this repo.
New Files with Low Code Health 1 new files where the code health is above the lower threshold for new code (8.1). 0 new files below the threshold.

var clientOptions = new ClientOptions
{
TIKA_ENABLE_MULTI_CLUSTER = false,
TIKA_API_ENDPOINT = "http://localhost:3000",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this port to 3001? It will collide a million billion times with the backstage frontend client

TIKA_ENABLE_MULTI_CLUSTER = ConfToBool(conf, "TIKA_ENABLE_MULTI_CLUSTER", false);

// Multi-cluster config
TIKA_MULTI_CLUSTER_HOSTNAME_PREFIX = ConfToString(conf, "TIKA_MULTI_CLUSTER_HOSTNAME_PREFIX", "http://tika-");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use options pattern for configs (IOptions) and ensure sensible defaults are set at the "property level"

@@ -6,19 +6,28 @@ namespace Tika.RestClient.Factories
{
public static class RestClientFactory
{
public static IRestClient Create(HttpClient httpClient)
public static IRestClient Create(HttpClient httpClient, ClientOptions options, string cluster = "")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default values in .net core should be assigned using default keyword so we dont have to change the right hand side of the assignment if we change the type on the left hand side!

}
else
{
httpClient.BaseAddress = new Uri($"{options.Value?.TIKA_MULTI_CLUSTER_HOSTNAME_PREFIX}-{cluster}:3000");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port is hardcoded, is that not a problem if sensible defaults is hardcoded in multiple places

{
var httpResponseMessage = await _httpClient.GetAsync(
new Uri(ACLS_ROUTE, UriKind.Relative)
new Uri(Utilities.MakeUrl(_clientOptions, ACLS_ROUTE, clusterId), UriKind.Absolute)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call this a helper? and not a utility since its a very specific function that solves a very specific problem?

Task<IEnumerable<ApiKey>> GetAllAsync();
Task<ApiKey> CreateAsync(ApiKeyCreate apiKeyCreate);
Task DeleteAsync(string key);
Task<IEnumerable<ApiKey>> GetAllAsync(string clusterId = null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value for "default" keyword is "null", "" or 0, false, etc. Please assign to = default and not = null

{
if (clientOptions.TIKA_ENABLE_MULTI_CLUSTER)
{
return $"{clientOptions.TIKA_MULTI_CLUSTER_HOSTNAME_PREFIX}{cluster}:3000{path}";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port 3000 hardcoded again :P

@SEQUOIIA SEQUOIIA merged commit 9e7bc28 into master May 12, 2021
@SEQUOIIA SEQUOIIA deleted the feat/kafka-multi-cluster branch July 27, 2022 12:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants