|
@@ -30,28 +30,28 @@ namespace TelpoKafkaConsole.WebApi.Controllers |
|
|
var topics = await _servicekafkaAdmin.DescribeTopicsAsync(new List<string> { consumer.Topic }); |
|
|
var topics = await _servicekafkaAdmin.DescribeTopicsAsync(new List<string> { consumer.Topic }); |
|
|
if (topics.Count.Equals(0)) |
|
|
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 |
|
|
// 创建 alcs |
|
|
List<AclBinding> aclBindings = new() |
|
|
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() |
|
|
new AclBinding() |
|
|
{ |
|
|
{ |
|
|
Pattern = new ResourcePattern |
|
|
Pattern = new ResourcePattern |
|
|