youzipi opened a new issue #6965:
URL: https://github.com/apache/pulsar/issues/6965
`org.apache.pulsar.client.api.Consumer#pause`
i use this method to pause consume util other necessery stuff is ready.
but it don't work as i expected.
```java
/**
* Stop requesting new messages from the broker until {@link #resume()}
is called. Note that this might cause
* {@link #receive()} to block until {@link #resume()} is called and new
messages are pushed by the broker.
*/
void pause();
```
I check pulsar's code, the `Consumer.paused` field is only used in
`org.apache.pulsar.client.impl.ConsumerImpl#increaseAvailablePermits(org.apache.pulsar.client.impl.ClientCnx,
int)`, after this method, the message will be sent to listener.
I do not found `Stop requesting new messages from the broker`?
do i misunderstand the comment?
#### Expected behavior
consumer stop receive msg
#### Actual behavior
consumer still receive msg.
#### Steps to reproduce
here is my pulsarConfig
```java
@Slf4j
@Data
@Configuration
@ConfigurationProperties("spring.pulsar")
public class PulsarConfig {
@Bean("crawlerInnerParseTopicConsumer")
public Consumer<String> crawlerInnerParseTopicConsumer(
PulsarClient pulsarClient,
CrawlerInnerParseConsumer listener
) throws PulsarClientException {
Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING)
.topic(crawlerInnerParseTopic)
.consumerName(consumerName)
.subscriptionType(SubscriptionType.Shared)
.subscriptionName(consumerName + "-crawlerInnerParseTopic")
.subscriptionInitialPosition(SubscriptionInitialPosition.Latest)
.messageListener(listener)
.subscribe();
log.info("[consumer pause],topic={}", crawlerInnerParseTopic);
consumer.pause();
return consumer;
}
}
```
#### System configuration
**Pulsar version**: 2.4.1
java pulsar-client-api: 2.4.1
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]