- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
背景
我们公司有由 Zookeeper 管理的 Apache Kafka。我们的 Spring Boot 应用程序之一需要检查所有可用主题的列表,并列出哪些主题启用了日志压缩 (cleanup.policy=compact)。
当前代码
@Bean
public ConsumerFactory<String, String> consumerFactory() {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaBrokerList);
props.put(ConsumerConfig.GROUP_ID_CONFIG, kafkaConsumerGroup);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
return new DefaultKafkaConsumerFactory<>(props);
}
...
...
public List<String> getTopics() {
Map<String, List<PartitionInfo>> topics = consumerFactory().createConsumer().listTopics();
List<String> topicList = new ArrayList<>();
topics.keySet().remove(CONSUMER_OFFSETS);
topicList.addAll(topics.keySet());
return topicList;
}
问题
通过上面的代码,应用程序可以获得主题列表。有没有办法也了解各个主题是否经过日志压缩?我正在寻找某种“Java”方式来获得与从终端运行以下 Apache Kafka CLI 命令时得到的相同响应。
kafka-topics --zookeeper localhost:2181 --describe --topic TestTopicCompact
对此的响应示例
Topic:TestTopicCompact PartitionCount:1 ReplicationFactor:1 Configs:cleanup.policy=compact
Topic: TestTopicCompact Partition: 0 Leader: 1001 Replicas: 1001 Isr: 1001
最佳答案
您应该使用AdminClient API检索该信息。
listTopics()
检索主题列表。describeConfigs()
获取每个主题的配置。 compact
作为 cleanup.policy
的主题。这基本上就是 kafka-topics
工具正在做的事情,因此您可以查看其源代码 kafka.admin.TopicCommand
。尽管它是 Scala,但概念是相似的。
关于java - Apache Kafka 客户端(Java): List topics and check whether topic is log compacted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57272855/
随着我们的应用程序的增长,我们需要更多的 Windows CE 设备空间。 我们安装了 SD 卡。从 sd 卡运行我们的应用程序很慢,如果您从持久路径运行应用程序,则需求分页会出现一些严重的问题。 我
是否可以在数据网格单元格中显示图像? 我目前正在使用紧凑型框架 3.5。 有什么建议吗? 最佳答案 就像其他海报评论的那样,你需要自己动手。幸运的是,这并不太难。 在我的应用程序中,我需要一种在特定列
我读了这个问题:Command Line Parser for .NET . 我以为这就是我要找的,但图书馆 Command Line Parser Library不是 Compact 框架友好的..
我用过 CF Remote Performance Monitor ,但是这似乎只跟踪在托管世界中初始化的内存,而不是在非托管世界中。好吧,我只能假设这是因为探查器中列出的数字远低于允许的最大值(CE
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 8年前关闭。 Improve thi
当我将字符串绘制到缓冲区中时,结果输出并没有像我期望的那样抗锯齿。这段代码说明了这个问题……只需将它放在标准智能设备项目的 Form1.cs 中: protected override void On
一位 friend 正在做在线 Scala 类(class)并分享了此内容。 # Write a recursive function that counts how many different w
如何仅使用紧凑型框架获取 MAC 地址? 最佳答案 OpenNETCF 代码的 1.4 从以下 P/Invoke 调用中获取信息: [DllImport ("iphlpapi.dll", Se
System.Diagnostics命名空间(尤其是 GetFrame(int frameNumber))在 CF 中不可用。在 CE (6.0 R3) 上运行时如何获取调用堆栈详细信息? 谢谢! 最
使用 .net Compact Framework 编写的应用程序可以自行重启吗? 实现这一目标的一些常见模式是什么?我想要一个自我更新的应用程序,如果更新完成,它会自行重启。 当然,我可以有 2 个
在 Compact Framework 上, System.Windows.Forms.Timer 类不支持 system.componentmodel 构造函数: 支持新的 Timer():http
在我的 Windows CE 6.0 应用程序中,我正在与返回错误 header 信息的专有 Web 服务器设备通信(更具体地说,它没有返回任何 header 信息)。 我认为缺少 header 信息
我只通过使用 Compact Any Size Classes .. 它可以在各种类型的手机上完美运行。 但 XCode Storyboard更喜欢对所有 iphone 纵向模式使用紧凑的常规尺寸类。
我目前正在将我的 Compact Framework 2.0 应用程序迁移到新的 Windows Embedded 7 Compact 机器上,并且必须为 CF 3.5 重新编译它。它编译但根本不运行
我有以下要求: 我需要一个适用于 CE (x86) + .NET Compact Framework 的 API 来播放视频(类似于 CorePlayer API...只是免费)? 还有其他可用的吗?
我正在使用 VS2008 和 .NET Compact Framework 3.5 构建一个可执行文件,目标是 Windows Mobile 6 Professional,但是每当我编译项目时,我在
尝试在我的新 PC 上的 Visual Studio 中构建 .CAB 时出现以下错误。来源是相同的。旧 PC 上也不存在注册表警告。 Windows CE CAB Wizard Warning: S
我正在尝试使用 Bouncy Castle v1.7在 Windows Mobile 6.5 设备上。 我正在尝试执行以下代码: ISigner signer = SignerUtilities.Ge
当我使用取消按钮关闭程序时,我收到一个应用程序错误,它所做的只是关闭表单。 错误说: “应用程序 appName.exe 遇到严重错误,必须关闭” 我该如何开始修复它?它不是抛出的异常;没有提供其他信
我知道 compact() 是一个标准的 php 函数。而 set() 是一种特定于蛋糕的方法。 我正在运行一个简单的测试,将值传递给使用 ajax 生成的 View (我的 Controller 中
我是一名优秀的程序员,十分优秀!