|
18 | 18 | */
|
19 | 19 | package org.apache.pulsar.broker.service.persistent;
|
20 | 20 |
|
21 |
| -import static org.apache.pulsar.broker.stats.prometheus.PrometheusMetricsClient.Metric; |
| 21 | +import com.google.common.collect.Multimap; |
| 22 | +import com.google.common.collect.Sets; |
22 | 23 | import static org.apache.pulsar.broker.stats.prometheus.PrometheusMetricsClient.parseMetrics;
|
23 | 24 | import static org.mockito.ArgumentMatchers.any;
|
24 | 25 | import static org.mockito.ArgumentMatchers.anyInt;
|
|
35 | 36 | import static org.testng.Assert.assertNull;
|
36 | 37 | import static org.testng.Assert.assertTrue;
|
37 | 38 | import static org.testng.Assert.fail;
|
38 |
| -import com.google.common.collect.Multimap; |
39 |
| -import com.google.common.collect.Sets; |
40 | 39 | import java.io.ByteArrayOutputStream;
|
41 | 40 | import java.lang.reflect.Field;
|
42 | 41 | import java.nio.charset.StandardCharsets;
|
|
74 | 73 | import org.apache.pulsar.broker.service.BrokerTestBase;
|
75 | 74 | import org.apache.pulsar.broker.service.Topic;
|
76 | 75 | import org.apache.pulsar.broker.service.TopicPoliciesService;
|
| 76 | +import org.apache.pulsar.broker.stats.prometheus.PrometheusMetricsClient.Metric; |
77 | 77 | import org.apache.pulsar.client.admin.PulsarAdminException;
|
78 | 78 | import org.apache.pulsar.client.api.Consumer;
|
79 | 79 | import org.apache.pulsar.client.api.Message;
|
|
102 | 102 | import org.testng.annotations.DataProvider;
|
103 | 103 | import org.testng.annotations.Test;
|
104 | 104 |
|
| 105 | + |
105 | 106 | @Slf4j
|
106 | 107 | @Test(groups = "broker")
|
107 | 108 | public class PersistentTopicTest extends BrokerTestBase {
|
@@ -216,6 +217,13 @@ public void testUnblockStuckSubscription() throws Exception {
|
216 | 217 | assertNotNull(msg);
|
217 | 218 | msg = consumer2.receive(5, TimeUnit.SECONDS);
|
218 | 219 | assertNotNull(msg);
|
| 220 | + |
| 221 | + org.apache.pulsar.broker.service.Consumer sharedConsumer = sharedDispatcher.getConsumers().get(0); |
| 222 | + Field blockField = org.apache.pulsar.broker.service.Consumer.class.getDeclaredField("blockedConsumerOnUnackedMsgs"); |
| 223 | + blockField.setAccessible(true); |
| 224 | + blockField.set(sharedConsumer, true); |
| 225 | + producer.newMessage().value("test").eventTime(5).send(); |
| 226 | + assertFalse(sharedSub.checkAndUnblockIfStuck()); |
219 | 227 | }
|
220 | 228 |
|
221 | 229 | @Test
|
|
0 commit comments