Search in sources :

Example 1 with PartitionedProducerImpl

use of com.yahoo.pulsar.client.impl.PartitionedProducerImpl in project pulsar by yahoo.

the class PartitionedProducerConsumerTest method testDeletePartitionedTopic.

@Test
public void testDeletePartitionedTopic() throws Exception {
    int numPartitions = 4;
    DestinationName dn = DestinationName.get("persistent://my-property/use/my-ns/my-partitionedtopic6");
    admin.persistentTopics().createPartitionedTopic(dn.toString(), numPartitions);
    Producer producer = pulsarClient.createProducer(dn.toString());
    Consumer consumer = pulsarClient.subscribe(dn.toString(), "my-sub");
    consumer.unsubscribe();
    consumer.close();
    producer.close();
    admin.persistentTopics().deletePartitionedTopic(dn.toString());
    Producer producer1 = pulsarClient.createProducer(dn.toString());
    if (producer1 instanceof PartitionedProducerImpl) {
        Assert.fail("should fail since partitioned topic was deleted");
    }
}
Also used : DestinationName(com.yahoo.pulsar.common.naming.DestinationName) PartitionedProducerImpl(com.yahoo.pulsar.client.impl.PartitionedProducerImpl) Test(org.testng.annotations.Test)

Aggregations

PartitionedProducerImpl (com.yahoo.pulsar.client.impl.PartitionedProducerImpl)1 DestinationName (com.yahoo.pulsar.common.naming.DestinationName)1 Test (org.testng.annotations.Test)1