Search in sources :

Example 16 with MessageRoutingMode

use of org.apache.pulsar.client.api.MessageRoutingMode in project incubator-pulsar by apache.

the class PersistentTopicE2ETest method testProducerReturnedMessageId.

@Test
public void testProducerReturnedMessageId() throws Exception {
    final String topicName = "persistent://prop/ns-abc/topic-xyz";
    // 1. producer connect
    Producer<byte[]> producer = pulsarClient.newProducer().topic(topicName).enableBatching(false).messageRoutingMode(MessageRoutingMode.SinglePartition).create();
    PersistentTopic topicRef = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get();
    assertNotNull(topicRef);
    assertEquals(topicRef.getProducers().size(), 1);
    ManagedLedgerImpl managedLedger = (ManagedLedgerImpl) topicRef.getManagedLedger();
    long ledgerId = managedLedger.getLedgersInfoAsList().get(0).getLedgerId();
    // 2. producer publish messages
    final int SyncMessages = 10;
    for (int i = 0; i < SyncMessages; i++) {
        String message = "my-message-" + i;
        MessageId receivedMessageId = producer.send(message.getBytes());
        assertEquals(receivedMessageId, new MessageIdImpl(ledgerId, i, -1));
    }
    // 3. producer publish messages async
    final int AsyncMessages = 10;
    final CountDownLatch counter = new CountDownLatch(AsyncMessages);
    for (int i = SyncMessages; i < (SyncMessages + AsyncMessages); i++) {
        String content = "my-message-" + i;
        final int index = i;
        producer.sendAsync(content.getBytes()).thenAccept((msgId) -> {
            assertEquals(msgId, new MessageIdImpl(ledgerId, index, -1));
            counter.countDown();
        }).exceptionally((ex) -> {
            return null;
        });
    }
    counter.await();
    // 4. producer disconnect
    producer.close();
}
Also used : Metrics(org.apache.pulsar.common.stats.Metrics) PulsarClientImpl(org.apache.pulsar.client.impl.PulsarClientImpl) LookupService(org.apache.pulsar.client.impl.LookupService) Producer(org.apache.pulsar.client.api.Producer) Cleanup(lombok.Cleanup) Test(org.testng.annotations.Test) AfterMethod(org.testng.annotations.AfterMethod) ByteBuffer(java.nio.ByteBuffer) ManagedLedgerFactoryImpl(org.apache.bookkeeper.mledger.impl.ManagedLedgerFactoryImpl) ManagedCursor(org.apache.bookkeeper.mledger.ManagedCursor) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) ToString(lombok.ToString) Assert.assertFalse(org.testng.Assert.assertFalse) SocketChannel(io.netty.channel.socket.SocketChannel) PulsarClientException(org.apache.pulsar.client.api.PulsarClientException) CyclicBarrier(java.util.concurrent.CyclicBarrier) ConsumerImpl(org.apache.pulsar.client.impl.ConsumerImpl) CompressionType(org.apache.pulsar.client.api.CompressionType) BeforeMethod(org.testng.annotations.BeforeMethod) Assert.assertNotNull(org.testng.Assert.assertNotNull) EqualsAndHashCode(lombok.EqualsAndHashCode) Sets(com.google.common.collect.Sets) Executors(java.util.concurrent.Executors) MessageIdImpl(org.apache.pulsar.client.impl.MessageIdImpl) CountDownLatch(java.util.concurrent.CountDownLatch) Consumer(org.apache.pulsar.client.api.Consumer) List(java.util.List) PersistentTopic(org.apache.pulsar.broker.service.persistent.PersistentTopic) PersistentSubscription(org.apache.pulsar.broker.service.persistent.PersistentSubscription) Optional(java.util.Optional) JSONSchema(org.apache.pulsar.client.impl.schema.JSONSchema) NamespaceBundleStats(org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats) Awaitility(org.awaitility.Awaitility) ProducerImpl(org.apache.pulsar.client.impl.ProducerImpl) TopicName(org.apache.pulsar.common.naming.TopicName) Assert.assertNull(org.testng.Assert.assertNull) DataProvider(org.testng.annotations.DataProvider) Assert.assertEquals(org.testng.Assert.assertEquals) Callable(java.util.concurrent.Callable) CompletableFuture(java.util.concurrent.CompletableFuture) Message(org.apache.pulsar.client.api.Message) SchemaType(org.apache.pulsar.common.schema.SchemaType) ArrayList(java.util.ArrayList) ProducerBuilder(org.apache.pulsar.client.api.ProducerBuilder) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) MessageRoutingMode(org.apache.pulsar.client.api.MessageRoutingMode) SubType(org.apache.pulsar.common.api.proto.CommandSubscribe.SubType) Assert(org.testng.Assert) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ProducerBusyException(org.apache.pulsar.client.api.PulsarClientException.ProducerBusyException) SchemaDefinition(org.apache.pulsar.client.api.schema.SchemaDefinition) PulsarClient(org.apache.pulsar.client.api.PulsarClient) PersistentDispatcherMultipleConsumers(org.apache.pulsar.broker.service.persistent.PersistentDispatcherMultipleConsumers) ExecutorService(java.util.concurrent.ExecutorService) SchemaRegistry(org.apache.pulsar.broker.service.schema.SchemaRegistry) ManagedLedgerImpl(org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl) TypedMessageBuilder(org.apache.pulsar.client.api.TypedMessageBuilder) TypedMessageBuilderImpl(org.apache.pulsar.client.impl.TypedMessageBuilderImpl) DEFAULT_CONSUMER_EPOCH(org.apache.pulsar.common.protocol.Commands.DEFAULT_CONSUMER_EPOCH) RetentionPolicies(org.apache.pulsar.common.policies.data.RetentionPolicies) MessageRedeliveryController(org.apache.pulsar.broker.service.persistent.MessageRedeliveryController) ServiceConfiguration(org.apache.pulsar.broker.ServiceConfiguration) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException) Assert.fail(org.testng.Assert.fail) Field(java.lang.reflect.Field) EntryCacheImpl(org.apache.bookkeeper.mledger.impl.EntryCacheImpl) PulsarService(org.apache.pulsar.broker.PulsarService) SubscriptionType(org.apache.pulsar.client.api.SubscriptionType) Schema(org.apache.pulsar.client.api.Schema) TimeUnit(java.util.concurrent.TimeUnit) MessageId(org.apache.pulsar.client.api.MessageId) CommandConnect(org.apache.pulsar.common.api.proto.CommandConnect) Data(lombok.Data) Assert.assertTrue(org.testng.Assert.assertTrue) SchemaData(org.apache.pulsar.common.protocol.schema.SchemaData) Schemas(org.apache.pulsar.schema.Schemas) ManagedLedgerImpl(org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl) PersistentTopic(org.apache.pulsar.broker.service.persistent.PersistentTopic) MessageIdImpl(org.apache.pulsar.client.impl.MessageIdImpl) ToString(lombok.ToString) CountDownLatch(java.util.concurrent.CountDownLatch) MessageId(org.apache.pulsar.client.api.MessageId) Test(org.testng.annotations.Test)

Example 17 with MessageRoutingMode

use of org.apache.pulsar.client.api.MessageRoutingMode in project incubator-pulsar by apache.

the class ReplicatorRateLimiterTest method testReplicatorRateLimiterMessageNotReceivedAllMessages.

/**
 * verifies dispatch rate for replicators works well for both Message limit and Byte limit .
 *
 * 1. verify topic replicator get configured.
 * 2. namespace setting of replicator dispatchRate, verify consumer in other cluster could not receive all messages.
 *
 * @throws Exception
 */
@Test(dataProvider = "dispatchRateType")
public void testReplicatorRateLimiterMessageNotReceivedAllMessages(DispatchRateType dispatchRateType) throws Exception {
    log.info("--- Starting ReplicatorTest::{} --- ", methodName);
    final String namespace = "pulsar/replicatorbyteandmsg-" + dispatchRateType.toString() + "-" + System.currentTimeMillis();
    final String topicName = "persistent://" + namespace + "/notReceivedAll";
    admin1.namespaces().createNamespace(namespace);
    // 0. set 2 clusters, there will be 1 replicator in each topic
    admin1.namespaces().setNamespaceReplicationClusters(namespace, Sets.newHashSet("r1", "r2"));
    final int messageRate = 100;
    DispatchRate dispatchRate;
    if (DispatchRateType.messageRate.equals(dispatchRateType)) {
        dispatchRate = DispatchRate.builder().dispatchThrottlingRateInMsg(messageRate).dispatchThrottlingRateInByte(-1).ratePeriodInSecond(360).build();
    } else {
        dispatchRate = DispatchRate.builder().dispatchThrottlingRateInMsg(-1).dispatchThrottlingRateInByte(messageRate).ratePeriodInSecond(360).build();
    }
    admin1.namespaces().setReplicatorDispatchRate(namespace, dispatchRate);
    @Cleanup PulsarClient client1 = PulsarClient.builder().serviceUrl(url1.toString()).statsInterval(0, TimeUnit.SECONDS).build();
    Producer<byte[]> producer = client1.newProducer().topic(topicName).enableBatching(false).messageRoutingMode(MessageRoutingMode.SinglePartition).create();
    PersistentTopic topic = (PersistentTopic) pulsar1.getBrokerService().getOrCreateTopic(topicName).get();
    boolean replicatorUpdated = false;
    int retry = 5;
    for (int i = 0; i < retry; i++) {
        if (topic.getReplicators().values().get(0).getRateLimiter().isPresent()) {
            replicatorUpdated = true;
            break;
        } else {
            if (i != retry - 1) {
                Thread.sleep(100);
            }
        }
    }
    Assert.assertTrue(replicatorUpdated);
    if (DispatchRateType.messageRate.equals(dispatchRateType)) {
        Assert.assertEquals(topic.getReplicators().values().get(0).getRateLimiter().get().getDispatchRateOnMsg(), messageRate);
    } else {
        Assert.assertEquals(topic.getReplicators().values().get(0).getRateLimiter().get().getDispatchRateOnByte(), messageRate);
    }
    @Cleanup PulsarClient client2 = PulsarClient.builder().serviceUrl(url2.toString()).statsInterval(0, TimeUnit.SECONDS).build();
    final AtomicInteger totalReceived = new AtomicInteger(0);
    Consumer<byte[]> consumer = client2.newConsumer().topic(topicName).subscriptionName("sub2-in-cluster2").messageListener((c1, msg) -> {
        Assert.assertNotNull(msg, "Message cannot be null");
        String receivedMessage = new String(msg.getData());
        log.debug("Received message [{}] in the listener", receivedMessage);
        totalReceived.incrementAndGet();
    }).subscribe();
    int numMessages = 500;
    // Asynchronously produce messages
    for (int i = 0; i < numMessages; i++) {
        producer.send(new byte[80]);
    }
    log.info("Received message number: [{}]", totalReceived.get());
    Assert.assertTrue(totalReceived.get() < messageRate * 2);
    consumer.close();
    producer.close();
}
Also used : DispatchRate(org.apache.pulsar.common.policies.data.DispatchRate) AfterClass(org.testng.annotations.AfterClass) Logger(org.slf4j.Logger) Assert.assertNull(org.testng.Assert.assertNull) DataProvider(org.testng.annotations.DataProvider) BeforeClass(org.testng.annotations.BeforeClass) Producer(org.apache.pulsar.client.api.Producer) LoggerFactory(org.slf4j.LoggerFactory) BeforeMethod(org.testng.annotations.BeforeMethod) Assert.assertEquals(org.testng.Assert.assertEquals) Cleanup(lombok.Cleanup) Test(org.testng.annotations.Test) Sets(com.google.common.collect.Sets) TimeUnit(java.util.concurrent.TimeUnit) Consumer(org.apache.pulsar.client.api.Consumer) MessageRoutingMode(org.apache.pulsar.client.api.MessageRoutingMode) PersistentTopic(org.apache.pulsar.broker.service.persistent.PersistentTopic) Assert(org.testng.Assert) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Assert.assertTrue(org.testng.Assert.assertTrue) PulsarClient(org.apache.pulsar.client.api.PulsarClient) Method(java.lang.reflect.Method) Awaitility(org.awaitility.Awaitility) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PersistentTopic(org.apache.pulsar.broker.service.persistent.PersistentTopic) DispatchRate(org.apache.pulsar.common.policies.data.DispatchRate) PulsarClient(org.apache.pulsar.client.api.PulsarClient) Cleanup(lombok.Cleanup) Test(org.testng.annotations.Test)

Example 18 with MessageRoutingMode

use of org.apache.pulsar.client.api.MessageRoutingMode in project incubator-pulsar by apache.

the class ReplicatorRateLimiterTest method testReplicatorRateLimiterMessageReceivedAllMessages.

/**
 * verifies dispatch rate for replicators works well for both Message limit.
 *
 * 1. verify topic replicator get configured.
 * 2. namespace setting of replicator dispatchRate,
 *      verify consumer in other cluster could receive all messages < message limit.
 * 3. verify consumer in other cluster could not receive all messages > message limit.
 *
 * @throws Exception
 */
@Test
public void testReplicatorRateLimiterMessageReceivedAllMessages() throws Exception {
    log.info("--- Starting ReplicatorTest::{} --- ", methodName);
    final String namespace = "pulsar/replicatormsg-" + System.currentTimeMillis();
    final String topicName = "persistent://" + namespace + "/notReceivedAll";
    admin1.namespaces().createNamespace(namespace);
    // 0. set 2 clusters, there will be 1 replicator in each topic
    admin1.namespaces().setNamespaceReplicationClusters(namespace, Sets.newHashSet("r1", "r2"));
    final int messageRate = 100;
    DispatchRate dispatchRate = DispatchRate.builder().dispatchThrottlingRateInMsg(messageRate).dispatchThrottlingRateInByte(-1).ratePeriodInSecond(360).build();
    admin1.namespaces().setReplicatorDispatchRate(namespace, dispatchRate);
    @Cleanup PulsarClient client1 = PulsarClient.builder().serviceUrl(url1.toString()).statsInterval(0, TimeUnit.SECONDS).build();
    Producer<byte[]> producer = client1.newProducer().topic(topicName).enableBatching(false).messageRoutingMode(MessageRoutingMode.SinglePartition).create();
    PersistentTopic topic = (PersistentTopic) pulsar1.getBrokerService().getOrCreateTopic(topicName).get();
    boolean replicatorUpdated = false;
    int retry = 5;
    for (int i = 0; i < retry; i++) {
        if (topic.getReplicators().values().get(0).getRateLimiter().isPresent()) {
            replicatorUpdated = true;
            break;
        } else {
            if (i != retry - 1) {
                Thread.sleep(100);
            }
        }
    }
    Assert.assertTrue(replicatorUpdated);
    Assert.assertEquals(topic.getReplicators().values().get(0).getRateLimiter().get().getDispatchRateOnMsg(), messageRate);
    @Cleanup PulsarClient client2 = PulsarClient.builder().serviceUrl(url2.toString()).statsInterval(0, TimeUnit.SECONDS).build();
    final AtomicInteger totalReceived = new AtomicInteger(0);
    Consumer<byte[]> consumer = client2.newConsumer().topic(topicName).subscriptionName("sub2-in-cluster2").messageListener((c1, msg) -> {
        Assert.assertNotNull(msg, "Message cannot be null");
        String receivedMessage = new String(msg.getData());
        log.debug("Received message [{}] in the listener", receivedMessage);
        totalReceived.incrementAndGet();
    }).subscribe();
    int numMessages = 50;
    // Asynchronously produce messages
    for (int i = 0; i < numMessages; i++) {
        producer.send(new byte[80]);
    }
    Thread.sleep(1000);
    log.info("Received message number: [{}]", totalReceived.get());
    Assert.assertEquals(totalReceived.get(), numMessages);
    numMessages = 200;
    // Asynchronously produce messages
    for (int i = 0; i < numMessages; i++) {
        producer.send(new byte[80]);
    }
    Thread.sleep(1000);
    log.info("Received message number: [{}]", totalReceived.get());
    Assert.assertEquals(totalReceived.get(), messageRate);
    consumer.close();
    producer.close();
}
Also used : DispatchRate(org.apache.pulsar.common.policies.data.DispatchRate) AfterClass(org.testng.annotations.AfterClass) Logger(org.slf4j.Logger) Assert.assertNull(org.testng.Assert.assertNull) DataProvider(org.testng.annotations.DataProvider) BeforeClass(org.testng.annotations.BeforeClass) Producer(org.apache.pulsar.client.api.Producer) LoggerFactory(org.slf4j.LoggerFactory) BeforeMethod(org.testng.annotations.BeforeMethod) Assert.assertEquals(org.testng.Assert.assertEquals) Cleanup(lombok.Cleanup) Test(org.testng.annotations.Test) Sets(com.google.common.collect.Sets) TimeUnit(java.util.concurrent.TimeUnit) Consumer(org.apache.pulsar.client.api.Consumer) MessageRoutingMode(org.apache.pulsar.client.api.MessageRoutingMode) PersistentTopic(org.apache.pulsar.broker.service.persistent.PersistentTopic) Assert(org.testng.Assert) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Assert.assertTrue(org.testng.Assert.assertTrue) PulsarClient(org.apache.pulsar.client.api.PulsarClient) Method(java.lang.reflect.Method) Awaitility(org.awaitility.Awaitility) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PersistentTopic(org.apache.pulsar.broker.service.persistent.PersistentTopic) DispatchRate(org.apache.pulsar.common.policies.data.DispatchRate) PulsarClient(org.apache.pulsar.client.api.PulsarClient) Cleanup(lombok.Cleanup) Test(org.testng.annotations.Test)

Example 19 with MessageRoutingMode

use of org.apache.pulsar.client.api.MessageRoutingMode in project incubator-pulsar by apache.

the class ProducerHandler method getProducerBuilder.

protected ProducerBuilder<byte[]> getProducerBuilder(PulsarClient client) {
    ProducerBuilder<byte[]> builder = client.newProducer().enableBatching(false).messageRoutingMode(MessageRoutingMode.SinglePartition);
    // Set to false to prevent the server thread from being blocked if a lot of messages are pending.
    builder.blockIfQueueFull(false);
    if (queryParams.containsKey("producerName")) {
        builder.producerName(queryParams.get("producerName"));
    }
    if (queryParams.containsKey("initialSequenceId")) {
        builder.initialSequenceId(Long.parseLong(queryParams.get("initialSequenceId")));
    }
    if (queryParams.containsKey("hashingScheme")) {
        builder.hashingScheme(HashingScheme.valueOf(queryParams.get("hashingScheme")));
    }
    if (queryParams.containsKey("sendTimeoutMillis")) {
        builder.sendTimeout(Integer.parseInt(queryParams.get("sendTimeoutMillis")), TimeUnit.MILLISECONDS);
    }
    if (queryParams.containsKey("batchingEnabled")) {
        builder.enableBatching(Boolean.parseBoolean(queryParams.get("batchingEnabled")));
    }
    if (queryParams.containsKey("batchingMaxMessages")) {
        builder.batchingMaxMessages(Integer.parseInt(queryParams.get("batchingMaxMessages")));
    }
    if (queryParams.containsKey("maxPendingMessages")) {
        builder.maxPendingMessages(Integer.parseInt(queryParams.get("maxPendingMessages")));
    }
    if (queryParams.containsKey("batchingMaxPublishDelay")) {
        builder.batchingMaxPublishDelay(Integer.parseInt(queryParams.get("batchingMaxPublishDelay")), TimeUnit.MILLISECONDS);
    }
    if (queryParams.containsKey("messageRoutingMode")) {
        checkArgument(Enums.getIfPresent(MessageRoutingMode.class, queryParams.get("messageRoutingMode")).isPresent(), "Invalid messageRoutingMode %s", queryParams.get("messageRoutingMode"));
        MessageRoutingMode routingMode = MessageRoutingMode.valueOf(queryParams.get("messageRoutingMode"));
        if (!MessageRoutingMode.CustomPartition.equals(routingMode)) {
            builder.messageRoutingMode(routingMode);
        }
    }
    if (queryParams.containsKey("compressionType")) {
        checkArgument(Enums.getIfPresent(CompressionType.class, queryParams.get("compressionType")).isPresent(), "Invalid compressionType %s", queryParams.get("compressionType"));
        builder.compressionType(CompressionType.valueOf(queryParams.get("compressionType")));
    }
    return builder;
}
Also used : MessageRoutingMode(org.apache.pulsar.client.api.MessageRoutingMode)

Example 20 with MessageRoutingMode

use of org.apache.pulsar.client.api.MessageRoutingMode in project incubator-pulsar by apache.

the class AbstractWebSocketHandlerTest method producerBuilderTest.

@Test
public void producerBuilderTest() throws IOException {
    String producerV2 = "/ws/v2/producer/persistent/my-property/my-ns/my-topic";
    // the params are all different with the default value
    Map<String, String[]> queryParams = new HashMap<String, String>() {

        {
            put("producerName", "my-producer");
            put("initialSequenceId", "1");
            put("hashingScheme", "Murmur3_32Hash");
            put("sendTimeoutMillis", "30001");
            put("batchingEnabled", "true");
            put("batchingMaxMessages", "1001");
            put("maxPendingMessages", "1001");
            put("batchingMaxPublishDelay", "2");
            put("messageRoutingMode", "RoundRobinPartition");
            put("compressionType", "LZ4");
        }
    }.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> new String[] { entry.getValue() }));
    httpServletRequest = mock(HttpServletRequest.class);
    when(httpServletRequest.getRequestURI()).thenReturn(producerV2);
    when(httpServletRequest.getParameterMap()).thenReturn(queryParams);
    WebSocketService service = mock(WebSocketService.class);
    when(service.isAuthenticationEnabled()).thenReturn(false);
    when(service.isAuthorizationEnabled()).thenReturn(false);
    when(service.getPulsarClient()).thenReturn(newPulsarClient());
    MockedServletUpgradeResponse response = new MockedServletUpgradeResponse(null);
    MockedProducerHandler producerHandler = new MockedProducerHandler(service, httpServletRequest, response);
    assertEquals(response.getStatusCode(), 500);
    assertTrue(response.getMessage().contains("Connection refused"));
    ProducerConfigurationData conf = producerHandler.getConf();
    assertEquals(conf.getProducerName(), "my-producer");
    assertEquals(conf.getInitialSequenceId().longValue(), 1L);
    assertEquals(conf.getHashingScheme(), HashingScheme.Murmur3_32Hash);
    assertEquals(conf.getSendTimeoutMs(), 30001);
    assertTrue(conf.isBatchingEnabled());
    assertEquals(conf.getBatchingMaxMessages(), 1001);
    assertEquals(conf.getMaxPendingMessages(), 1001);
    assertEquals(conf.getBatchingMaxPublishDelayMicros(), 2000);
    assertEquals(conf.getMessageRoutingMode(), MessageRoutingMode.RoundRobinPartition);
    assertEquals(conf.getCompressionType(), CompressionType.LZ4);
    producerHandler.clearQueryParams();
    conf = producerHandler.getConf();
    // By default batching is disabled, which is different with ProducerBuilder
    assertFalse(conf.isBatchingEnabled());
    // The default message routing mode is SinglePartition, which is different with ProducerBuilder
    assertEquals(conf.getMessageRoutingMode(), MessageRoutingMode.SinglePartition);
    producerHandler.putQueryParam("messageRoutingMode", "CustomPartition");
    conf = producerHandler.getConf();
    // ProducerHandler doesn't support CustomPartition
    assertEquals(conf.getMessageRoutingMode(), MessageRoutingMode.SinglePartition);
}
Also used : TopicName(org.apache.pulsar.common.naming.TopicName) Getter(lombok.Getter) ConsumerConfigurationData(org.apache.pulsar.client.impl.conf.ConsumerConfigurationData) Mock(org.mockito.Mock) SubscriptionMode(org.apache.pulsar.client.api.SubscriptionMode) Assert.assertEquals(org.testng.Assert.assertEquals) HashMap(java.util.HashMap) Test(org.testng.annotations.Test) ArrayList(java.util.ArrayList) MessageRoutingMode(org.apache.pulsar.client.api.MessageRoutingMode) HttpServletRequest(javax.servlet.http.HttpServletRequest) Map(java.util.Map) ProducerBuilderImpl(org.apache.pulsar.client.impl.ProducerBuilderImpl) ServletUpgradeResponse(org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse) PulsarClient(org.apache.pulsar.client.api.PulsarClient) ConsumerBuilderImpl(org.apache.pulsar.client.impl.ConsumerBuilderImpl) Assert.assertFalse(org.testng.Assert.assertFalse) PulsarClientException(org.apache.pulsar.client.api.PulsarClientException) AfterClass(org.testng.annotations.AfterClass) CompressionType(org.apache.pulsar.client.api.CompressionType) HttpServletResponse(javax.servlet.http.HttpServletResponse) IOException(java.io.IOException) Mockito.when(org.mockito.Mockito.when) SubscriptionType(org.apache.pulsar.client.api.SubscriptionType) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) AuthenticationDataSource(org.apache.pulsar.broker.authentication.AuthenticationDataSource) HashingScheme(org.apache.pulsar.client.api.HashingScheme) ProducerConfigurationData(org.apache.pulsar.client.impl.conf.ProducerConfigurationData) TimeUnit(java.util.concurrent.TimeUnit) URLEncoder(java.net.URLEncoder) List(java.util.List) Assert.assertTrue(org.testng.Assert.assertTrue) Collections(java.util.Collections) Mockito.mock(org.mockito.Mockito.mock) HttpServletRequest(javax.servlet.http.HttpServletRequest) ProducerConfigurationData(org.apache.pulsar.client.impl.conf.ProducerConfigurationData) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.testng.annotations.Test)

Aggregations

MessageRoutingMode (org.apache.pulsar.client.api.MessageRoutingMode)32 TimeUnit (java.util.concurrent.TimeUnit)24 Test (org.testng.annotations.Test)24 Sets (com.google.common.collect.Sets)21 Producer (org.apache.pulsar.client.api.Producer)21 PulsarClient (org.apache.pulsar.client.api.PulsarClient)21 Awaitility (org.awaitility.Awaitility)21 Assert (org.testng.Assert)21 Assert.assertEquals (org.testng.Assert.assertEquals)21 Assert.assertTrue (org.testng.Assert.assertTrue)21 BeforeMethod (org.testng.annotations.BeforeMethod)21 ArrayList (java.util.ArrayList)18 List (java.util.List)18 Map (java.util.Map)18 Cleanup (lombok.Cleanup)18 Consumer (org.apache.pulsar.client.api.Consumer)18 HashMap (java.util.HashMap)15 PersistentTopic (org.apache.pulsar.broker.service.persistent.PersistentTopic)15 MessageId (org.apache.pulsar.client.api.MessageId)15 PulsarClientException (org.apache.pulsar.client.api.PulsarClientException)15