ivankelly commented on a change in pull request #1858: Cpp client: add 
readCompacted in consumer config
URL: https://github.com/apache/incubator-pulsar/pull/1858#discussion_r192994913
 
 

 ##########
 File path: pulsar-client-cpp/python/pulsar_test.py
 ##########
 @@ -405,6 +412,53 @@ def test_reader_argument_errors(self):
         self._check_value_error(lambda: client.create_reader(topic, 
MessageId.earliest, reader_name=5))
         client.close()
 
+    def test_publish_compact_and_consume(self):
+        client = Client(self.serviceUrl)
+        topic = 
'persistent://sample/standalone/ns1/my-python-test_publish_compact_and_consume'
+        producer = client.create_producer(topic, 
producer_name='my-producer-name', batching_enabled=False)
+        self.assertEqual(producer.last_sequence_id(), -1)
+        consumer = client.subscribe(topic, 'my-sub1', is_read_compacted=True)
+        consumer.close()
+        consumer2 = client.subscribe(topic, 'my-sub2', is_read_compacted=False)
+
+        # producer create 2 messages with same key.
+        producer.send('hello-0', partition_key='key0')
+        producer.send('hello-1', partition_key='key0')
+        producer.close()
+
+        # issue compact command, and wait success
+        url=self.adminUrl + 
'/admin/persistent/sample/standalone/ns1/my-python-test_publish_compact_and_consume/compaction'
+        doHttpPut(url, '')
+        while True:
+            req = urllib2.Request(url)
+            response = urllib2.urlopen(req)
+            s=response.read()
+            if 'RUNNING' in s:
+                print("Compact still running")
+                print(s)
+                time.sleep(0.2)
+            else:
+                print("Compact Complete now")
 
 Review comment:
   should check that status is "SUCCESS"

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to