H Vs пре 5 месеци
родитељ
комит
1fbfa894d7
3 измењених фајлова са 19 додато и 19 уклоњено
  1. +1
    -1
      TelpoKafkaConsole.Service/KafkaAdminService.cs
  2. +17
    -17
      TelpoKafkaConsole.WebApi/Controllers/ScramAclsController.cs
  3. +1
    -1
      TelpoKafkaConsole.WebApi/Controllers/TopicController.cs

+ 1
- 1
TelpoKafkaConsole.Service/KafkaAdminService.cs Прегледај датотеку

@@ -324,7 +324,7 @@ namespace TelpoKafkaConsole.Service
new() {
Name = topicName,
ReplicationFactor = 1,
NumPartitions = numPartitions,
NumPartitions = numPartitions>3 ? 3 : numPartitions,
Configs = configEntries
}
});


+ 17
- 17
TelpoKafkaConsole.WebApi/Controllers/ScramAclsController.cs Прегледај датотеку

@@ -30,28 +30,28 @@ namespace TelpoKafkaConsole.WebApi.Controllers
var topics = await _servicekafkaAdmin.DescribeTopicsAsync(new List<string> { consumer.Topic });
if (topics.Count.Equals(0))
{
await _servicekafkaAdmin.CreateTopic(consumer.Topic, TimeSpan.FromDays(3), consumer.NumPartitions);
await _servicekafkaAdmin.CreateTopic(consumer.Topic, TimeSpan.FromDays(3), consumer.NumPartitions>3 ? 3: consumer.NumPartitions);
}
// 创建 alcs
List<AclBinding> aclBindings = new()
{
new AclBinding()
{
Pattern = new ResourcePattern
{
Type = ResourceType.Broker,
Name = "kafka-cluster",
ResourcePatternType = ResourcePatternType.Literal
},
Entry = new AccessControlEntry
{
Principal = $"User:{consumer.Name}",
Host = "*",
Operation = AclOperation.All,
PermissionType = AclPermissionType.Deny
}
},
//new AclBinding()
//{
// Pattern = new ResourcePattern
// {
// Type = ResourceType.Broker,
// Name = "kafka-cluster",
// ResourcePatternType = ResourcePatternType.Literal
// },
// Entry = new AccessControlEntry
// {
// Principal = $"User:{consumer.Name}",
// Host = "*",
// Operation = AclOperation.All,
// PermissionType = AclPermissionType.Deny
// }
//},
new AclBinding()
{
Pattern = new ResourcePattern


+ 1
- 1
TelpoKafkaConsole.WebApi/Controllers/TopicController.cs Прегледај датотеку

@@ -26,7 +26,7 @@ namespace TelpoKafkaConsole.WebApi.Controllers
[HttpPost]
public async Task<ApiResponse<string>> Post([FromBody] TopicReq topic)
{
await _servicekafkaAdmin.CreateTopic(topic.TopicName,TimeSpan.FromDays(3));
await _servicekafkaAdmin.CreateTopic(topic.TopicName,TimeSpan.FromDays(3), topic.NumPartitions);
return ApiResponse<string>.Success($"创建 Topic {topic} 成功");
}



Loading…
Откажи
Сачувај