You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "michalcukierman (via GitHub)" <gi...@apache.org> on 2023/09/01 11:14:14 UTC
[GitHub] [pulsar] michalcukierman commented on issue #21104: [Bug] Client with shared subscription is blocked
michalcukierman commented on issue #21104:
URL: https://github.com/apache/pulsar/issues/21104#issuecomment-1702584503
Two files attached:
[partitioned.stats.internal.txt](https://github.com/apache/pulsar/files/12497246/partitioned.stats.internal.txt)
[partitioned.stats.txt](https://github.com/apache/pulsar/files/12497248/partitioned.stats.txt)
I see that in stats we have:
```
"availablePermits" : 0,
"unackedMessages" : 25,
"availablePermits" : 0,
"unackedMessages" : 32,
```
, but I do ack all of the messages:
```java
Consumer consumer = client.newConsumer()
.topic(sourceTopic)
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
.subscriptionName(subscriptionName)
.subscriptionType(SubscriptionType.Shared)
.receiverQueueSize(8)
.ackTimeout(ackTimeout, TimeUnit.SECONDS)
.subscribe();
Producer<byte[]> producer = client.newProducer(Schema.BYTES)
.topic(destinationTopic)
.compressionType(CompressionType.LZ4)
.maxPendingMessages(8) // Support 5 MB files
.blockIfQueueFull(true) // Support 5 MB files
.batchingMaxBytes(5242880)
.create();
Multi<Messagemessages = Multi.createBy().repeating()
.completionStage(consumer::receiveAsync)
.until(m -> closed.get());
messages.subscribe().with(msg -> {
receivedDistribution.record(getKiloBytesSize(msg.getData()));
Uni.createFrom().completionStage(producer.newMessage(Schema.BYTES)
.key(msg.getKey())
.value(msg.getValue().getContent().getPayload().toByteArray())
.eventTime(msg.getEventTime()).sendAsync())
.subscribe().with(msgId -> {
sentCounter.increment();
try {
consumer.acknowledge(msg.getMessageId());
} catch (PulsarClientException e) {
throw new RuntimeException("Unable to send or ACK the message", e);
}
});
});
}
```
It can be confirmed in the log files, where sentCounter is just on message behind
<img width="1165" alt="Screenshot 2023-09-01 at 13 11 49" src="https://github.com/apache/pulsar/assets/4356553/71eac4c5-9f9a-4626-aeee-e89cf125e19c">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org