要解决Apache Pulsar中无法从getCounter()读取值的问题,可以尝试以下解决方法:
Counter myCounter = pulsarClient.newCounter().create().get();
Counter myCounter = pulsarClient.newCounter()
.counterName("my-counter")
.create().get();
myCounter.add(1);
long counterValue = myCounter.get().get();
long otherValue = myCounter.getValue();
请注意,以上解决方法仅为一般指导,具体情况可能因您的代码和环境而异。建议查阅Apache Pulsar的官方文档或寻求相关支持以获取更详细和针对性的解决方案。