Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix close() returns ResultAlreadyClosed after unsubscribe or close #338

Merged

Conversation

BewareMyPower
Copy link
Contributor

Fixes #88

Motivation

When close is called if the consumer has already called unsubscribe or close, it should not fail. See

https://github.com/apache/pulsar/blob/428c18c8d0c3d135189920740192982e11ffb2bf/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1034

Modifications

Use the same close logic with Java client.

Add testCloseAgainBeforeCloseDone and testCloseAfterUnsubscribe to verify the new behaviors of Consumer::close.

@BewareMyPower BewareMyPower added the bug Something isn't working label Nov 8, 2023
@BewareMyPower BewareMyPower added this to the 3.5.0 milestone Nov 8, 2023
@BewareMyPower BewareMyPower self-assigned this Nov 8, 2023
@BewareMyPower BewareMyPower marked this pull request as draft November 8, 2023 14:52
Fixes apache#88

### Motivation

When `close` is called if the consumer has already called `unsubscribe`
or `close`, it should not fail. See

https://github.com/apache/pulsar/blob/428c18c8d0c3d135189920740192982e11ffb2bf/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1034

### Modifications

Use the same close logic with Java client.

Add `testCloseAgainBeforeCloseDone` and `testCloseAfterUnsubscribe` to
verify the new behaviors of `Consumer::close`.
@BewareMyPower BewareMyPower force-pushed the bewaremypower/fix-unsubscribe-stats branch from 19d82fe to f67a709 Compare November 9, 2023 08:55
@BewareMyPower BewareMyPower changed the title Fix close() returns ResultAlreadyClosed after unsubscribe Fix close() returns ResultAlreadyClosed after unsubscribe or close Nov 9, 2023
@BewareMyPower BewareMyPower marked this pull request as ready for review November 9, 2023 08:58
@BewareMyPower BewareMyPower merged commit a8402da into apache:main Nov 10, 2023
11 checks passed
@BewareMyPower BewareMyPower deleted the bewaremypower/fix-unsubscribe-stats branch November 10, 2023 02:55
@BewareMyPower BewareMyPower modified the milestones: 3.5.0, 3.4.1 Nov 16, 2023
BewareMyPower added a commit that referenced this pull request Nov 17, 2023
)

Fixes #88

### Motivation

When `close` is called if the consumer has already called `unsubscribe`
or `close`, it should not fail. See

https://github.com/apache/pulsar/blob/428c18c8d0c3d135189920740192982e11ffb2bf/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1034

### Modifications

Use the same close logic with Java client.

Add `testCloseAgainBeforeCloseDone` and `testCloseAfterUnsubscribe` to
verify the new behaviors of `Consumer::close`.

(cherry picked from commit a8402da)
BewareMyPower pushed a commit that referenced this pull request Mar 11, 2024
…scribe or close (#413)

Fixes #88

### Motivation

#338 fixed `ConsumerImpl::closeAsync` so that closing after it was already closed or unsubscribed returns `ResultOk` instead of `ResultAlreadyClosed`. However, `MultiTopicsConsumerImpl::closeAsync` still returns `ResultAlreadyClosed`. This seems to be a change omission.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[python client] cannot close consumer after an unsubscribe
3 participants