You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 satır
2.7KB

  1. //using Confluent.Kafka;
  2. //using Confluent.Kafka.Admin;
  3. //using Microsoft.AspNetCore.Mvc;
  4. //using TelpoKafkaConsole.Service;
  5. //using TelpoKafkaConsole.WebApi.Controllers.Api;
  6. //namespace TelpoKafkaConsole.WebApi.Controllers
  7. //{
  8. // [ApiController]
  9. // [Route("[controller]")]
  10. // public class WeatherForecastController : ControllerBase
  11. // {
  12. // private readonly KafkaAdminService _servicekafkaAdmin;
  13. // private static readonly string[] Summaries = new[]
  14. // {
  15. // "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
  16. // };
  17. // private readonly ILogger<WeatherForecastController> _logger;
  18. // public WeatherForecastController(ILogger<WeatherForecastController> logger, KafkaAdminService kafkaAdminService)
  19. // {
  20. // _logger = logger;
  21. // _servicekafkaAdmin = kafkaAdminService;
  22. // }
  23. // //[HttpGet(Name = "GetWeatherForecast")]
  24. // //public IEnumerable<WeatherForecast> Get()
  25. // //{
  26. // // return Enumerable.Range(1, 5).Select(index => new WeatherForecast
  27. // // {
  28. // // Date = DateTime.Now.AddDays(index),
  29. // // TemperatureC = Random.Shared.Next(-20, 55),
  30. // // Summary = Summaries[Random.Shared.Next(Summaries.Length)]
  31. // // })
  32. // // .ToArray();
  33. // //}
  34. // //[HttpGet(Name = "GetGroup")]
  35. // //public ApiResponse<List<GroupInfo>> GetGroup()
  36. // //{
  37. // // var group = _servicekafkaAdmin.ListGroups();
  38. // // return ApiResponse<List<GroupInfo>>.Success(group);
  39. // //}
  40. // [HttpGet(Name = "GetGroup")]
  41. // public async Task<ApiResponse<string>> GetGroupAsync()
  42. // {
  43. // // var group = _servicekafkaAdmin.ListGroups();
  44. // List<AclBinding> aclBindings = new()
  45. // {
  46. // new AclBinding()
  47. // {
  48. // Pattern = new ResourcePattern
  49. // {
  50. // Type = ResourceType.Broker,
  51. // Name = "kafka-cluster",
  52. // ResourcePatternType = ResourcePatternType.Literal
  53. // },
  54. // Entry = new AccessControlEntry
  55. // {
  56. // Principal = $"User:telpo-consumer",
  57. // Host = "*",
  58. // Operation = AclOperation.All,
  59. // PermissionType = AclPermissionType.Deny
  60. // }
  61. // }
  62. // };
  63. // await _servicekafkaAdmin.CreateAclsAsync(aclBindings);
  64. // return ApiResponse<string>.Success("ok");
  65. // }
  66. // }
  67. //}