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

Enhancement 10 #31

Merged
merged 8 commits into from
Mar 7, 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 src/java/kafkabridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<name>mases.kafkabridge</name>
<description>Apache Kafka interface bridging implementation</description>
<url>https://github.com/masesgroup/KafkaBridge</url>
<version>1.1.7.0</version>
<version>1.1.8.0</version>

<licenses>
<license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
* Refer to LICENSE for more information.
*/

using MASES.KafkaBridge.Common.Config;
using MASES.KafkaBridge.Java.Util;

namespace MASES.KafkaBridge.Clients.Admin
{
public class AdminClientConfig : JCOBridge.C2JBridge.JVMBridgeBase<AdminClientConfig>
public class AdminClientConfig : AbstractConfig<AdminClientConfig>
{
public override string ClassName => "org.apache.kafka.clients.admin.AdminClientConfig";

Expand Down Expand Up @@ -64,6 +65,8 @@ public class AdminClientConfig : JCOBridge.C2JBridge.JVMBridgeBase<AdminClientCo
public static readonly string RETRIES_CONFIG = Clazz.GetField<string>("RETRIES_CONFIG");
public static readonly string DEFAULT_API_TIMEOUT_MS_CONFIG = Clazz.GetField<string>("DEFAULT_API_TIMEOUT_MS_CONFIG");

public static readonly string SECURITY_PROVIDERS_CONFIG = Clazz.GetField<string>("SECURITY_PROVIDERS_CONFIG");

[System.Obsolete("This is not public in Apache Kafka API")]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public AdminClientConfig() { }
Expand All @@ -73,4 +76,16 @@ public AdminClientConfig(Map props)
{
}
}

public class AdminClientConfigBuilder : CommonClientConfigsBuilder<AdminClientConfigBuilder>
{
public string SecurityProviders { get { return GetProperty<string>(AdminClientConfig.SECURITY_PROVIDERS_CONFIG); } set { SetProperty(AdminClientConfig.SECURITY_PROVIDERS_CONFIG, value); } }

public AdminClientConfigBuilder WithSecurityProviders(string securityProviders)
{
var clone = Clone();
clone.SecurityProviders = securityProviders;
return clone;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class AlterClientQuotasResult : JCOBridge.C2JBridge.JVMBridgeBase<AlterCl
{
public override string ClassName => "org.apache.kafka.clients.admin.AlterClientQuotasResult";

public Map<ClientQuotaEntity, KafkaFuture<Void>> values => IExecute<Map<ClientQuotaEntity, KafkaFuture<Void>>>("values");
public Map<ClientQuotaEntity, KafkaFuture<Void>> Values => IExecute<Map<ClientQuotaEntity, KafkaFuture<Void>>>("values");

public KafkaFuture<Void> All => IExecute<KafkaFuture<Void>>("all");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class AlterUserScramCredentialsResult : JCOBridge.C2JBridge.JVMBridgeBase
{
public override string ClassName => "org.apache.kafka.clients.admin.AlterUserScramCredentialsResult";

public Map<string, KafkaFuture<Void>> values => IExecute<Map<string, KafkaFuture<Void>>>("values");
public Map<string, KafkaFuture<Void>> Values => IExecute<Map<string, KafkaFuture<Void>>>("values");

public KafkaFuture<Void> All => IExecute<KafkaFuture<Void>>("all");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CreatePartitionsResult : JCOBridge.C2JBridge.JVMBridgeBase<CreatePa

public Map<string, KafkaFuture<Void>> Values => IExecute<Map<string, KafkaFuture<Void>>>("values");

public KafkaFuture<Void> All => IExecute < KafkaFuture<Void>>("all");
public KafkaFuture<Void> All => IExecute<KafkaFuture<Void>>("all");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class DescribeConsumerGroupsResult : JCOBridge.C2JBridge.JVMBridgeBase<De
{
public override string ClassName => "org.apache.kafka.clients.admin.DescribeConsumerGroupsResult";

public Map<string, KafkaFuture<ConsumerGroupDescription>> describedGroups => IExecute<Map<string, KafkaFuture<ConsumerGroupDescription>>>("describedGroups");
public Map<string, KafkaFuture<ConsumerGroupDescription>> DescribedGroups => IExecute<Map<string, KafkaFuture<ConsumerGroupDescription>>>("describedGroups");

public KafkaFuture<Map<string, ConsumerGroupDescription>> All => IExecute<KafkaFuture<Map<string, ConsumerGroupDescription>>>("all");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public class DescribeLogDirsResult : JCOBridge.C2JBridge.JVMBridgeBase<DescribeL
{
public override string ClassName => "org.apache.kafka.clients.admin.DescribeLogDirsResult";

public Map<int, KafkaFuture<Map<string, DescribeLogDirsResponse.LogDirInfo>>> values => IExecute<Map<int, KafkaFuture<Map<string, DescribeLogDirsResponse.LogDirInfo>>>>("descriptions");
public Map<int, KafkaFuture<Map<string, DescribeLogDirsResponse.LogDirInfo>>> Values => IExecute<Map<int, KafkaFuture<Map<string, DescribeLogDirsResponse.LogDirInfo>>>>("descriptions");

public Map<int, KafkaFuture<Map<string, LogDirDescription>>> descriptions => IExecute<Map<int, KafkaFuture<Map<string, LogDirDescription>>>>("descriptions");
public Map<int, KafkaFuture<Map<string, LogDirDescription>>> Descriptions => IExecute<Map<int, KafkaFuture<Map<string, LogDirDescription>>>>("descriptions");

public KafkaFuture<Map<int, Map<string, LogDirDescription>>> allDescriptions => IExecute<KafkaFuture<Map<int, Map<string, LogDirDescription>>>>("allDescriptions");
public KafkaFuture<Map<int, Map<string, LogDirDescription>>> AllDescriptions => IExecute<KafkaFuture<Map<int, Map<string, LogDirDescription>>>>("allDescriptions");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public class DescribeUserScramCredentialsResult : JCOBridge.C2JBridge.JVMBridgeB

public KafkaFuture<List<string>> Users => IExecute<KafkaFuture<List<string>>>("users");

public KafkaFuture<UserScramCredentialsDescription> description(string userName)
public KafkaFuture<UserScramCredentialsDescription> Description(string userName)
{
return IExecute< KafkaFuture<UserScramCredentialsDescription>>("description");
return IExecute< KafkaFuture<UserScramCredentialsDescription>>("description", userName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public class ListConsumerGroupOffsetsResult : JCOBridge.C2JBridge.JVMBridgeBase<
{
public override string ClassName => "org.apache.kafka.clients.admin.ListConsumerGroupOffsetsResult";

public KafkaFuture<Map<TopicPartition, OffsetAndMetadata>> partitionsToOffsetAndMetadata => IExecute<KafkaFuture<Map<TopicPartition, OffsetAndMetadata>>>("partitionsToOffsetAndMetadata");
public KafkaFuture<Map<TopicPartition, OffsetAndMetadata>> PartitionsToOffsetAndMetadata => IExecute<KafkaFuture<Map<TopicPartition, OffsetAndMetadata>>>("partitionsToOffsetAndMetadata");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Refer to LICENSE for more information.
*/

using MASES.KafkaBridge.Common.Config;
using MASES.KafkaBridge.Java.Util;

namespace MASES.KafkaBridge.Clients.Admin
Expand All @@ -24,6 +25,8 @@ public class NewTopic : JCOBridge.C2JBridge.JVMBridgeBase<NewTopic>
{
public override string ClassName => "org.apache.kafka.clients.admin.NewTopic";

[System.Obsolete("This is not public in Apache Kafka API", true)]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public NewTopic()
{
}
Expand All @@ -33,10 +36,30 @@ public NewTopic(string name, int numPartitions = 1, short replicationFactor = 1)
{
}

public NewTopic(string name, Map<int, List<int>> replicasAssignments)
:base(name, replicasAssignments)
{
}

public string Name => IExecute<string>("name");

public int NumPartitions => IExecute<int>("numPartitions");

public int ReplicationFactor => IExecute<int>("replicationFactor");

public Map<int, List<int>> ReplicasAssignments => IExecute<Map<int, List<int>>>("replicasAssignments");

public NewTopic Configs(Map<string, string> configs)
{
return IExecute<NewTopic>("configs", configs);
}

public NewTopic Configs(TopicConfigBuilder config)
{
return Configs(config.ToMap());
}

public Map<string, string> Configs() => IExecute<Map<string, string>>("configs");
}
}

Loading