Search in sources :

Example 6 with Producer

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

the class SchedulerManagerTest method testScalingDown.

@Test
public void testScalingDown() throws Exception {
    List<Function.FunctionMetaData> functionMetaDataList = new LinkedList<>();
    long version = 5;
    Function.FunctionMetaData function1 = Function.FunctionMetaData.newBuilder().setFunctionConfig(Function.FunctionConfig.newBuilder().setName("func-1").setNamespace("namespace-1").setTenant("tenant-1").setParallelism(1)).setVersion(version).build();
    Function.FunctionMetaData function2 = Function.FunctionMetaData.newBuilder().setFunctionConfig(Function.FunctionConfig.newBuilder().setName("func-2").setNamespace("namespace-1").setTenant("tenant-1").setParallelism(3)).setVersion(version).build();
    functionMetaDataList.add(function1);
    functionMetaDataList.add(function2);
    doReturn(functionMetaDataList).when(functionMetaDataManager).getAllFunctionMetaData();
    // set assignments
    Function.Assignment assignment1 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function1).setInstanceId(0).build()).build();
    Map<String, Map<String, Function.Assignment>> currentAssignments = new HashMap<>();
    Map<String, Function.Assignment> assignmentEntry1 = new HashMap<>();
    assignmentEntry1.put(Utils.getFullyQualifiedInstanceId(assignment1.getInstance()), assignment1);
    currentAssignments.put("worker-1", assignmentEntry1);
    doReturn(currentAssignments).when(functionRuntimeManager).getCurrentAssignments();
    // set version
    doReturn(version).when(functionRuntimeManager).getCurrentAssignmentVersion();
    // single node
    List<MembershipManager.WorkerInfo> workerInfoList = new LinkedList<>();
    workerInfoList.add(MembershipManager.WorkerInfo.of("worker-1", "workerHostname-1", 5000));
    doReturn(workerInfoList).when(membershipManager).getCurrentMembership();
    // i am leader
    doReturn(true).when(membershipManager).isLeader();
    callSchedule();
    List<Invocation> invocations = getMethodInvocationDetails(producer, Producer.class.getMethod("sendAsync", Object.class));
    Assert.assertEquals(invocations.size(), 1);
    byte[] send = (byte[]) invocations.get(0).getRawArguments()[0];
    Request.AssignmentsUpdate assignmentsUpdate = Request.AssignmentsUpdate.parseFrom(send);
    log.info("assignmentsUpdate: {}", assignmentsUpdate);
    Function.Assignment assignment2_1 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function2).setInstanceId(0).build()).build();
    Function.Assignment assignment2_2 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function2).setInstanceId(1).build()).build();
    Function.Assignment assignment2_3 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function2).setInstanceId(2).build()).build();
    Assert.assertEquals(assignmentsUpdate, Request.AssignmentsUpdate.newBuilder().setVersion(version + 1).addAssignments(assignment1).addAssignments(assignment2_1).addAssignments(assignment2_2).addAssignments(assignment2_3).build());
    // scale down
    PulsarClient pulsarClient = mock(PulsarClient.class);
    doReturn(producer).when(pulsarClient).createProducer(any(), any());
    Function.FunctionMetaData function2Scaled = Function.FunctionMetaData.newBuilder().setFunctionConfig(Function.FunctionConfig.newBuilder().setName("func-2").setNamespace("namespace-1").setTenant("tenant-1").setParallelism(1)).setVersion(version).build();
    functionMetaDataList = new LinkedList<>();
    functionMetaDataList.add(function1);
    functionMetaDataList.add(function2Scaled);
    doReturn(functionMetaDataList).when(functionMetaDataManager).getAllFunctionMetaData();
    Function.Assignment assignment2Scaled = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function2Scaled).setInstanceId(0).build()).build();
    callSchedule();
    invocations = getMethodInvocationDetails(producer, Producer.class.getMethod("sendAsync", Object.class));
    Assert.assertEquals(invocations.size(), 2);
    send = (byte[]) invocations.get(1).getRawArguments()[0];
    assignmentsUpdate = Request.AssignmentsUpdate.parseFrom(send);
    Assert.assertEquals(assignmentsUpdate, Request.AssignmentsUpdate.newBuilder().setVersion(version + 1 + 1).addAssignments(assignment1).addAssignments(assignment2Scaled).build());
}
Also used : Invocation(org.mockito.invocation.Invocation) HashMap(java.util.HashMap) Request(org.apache.pulsar.functions.proto.Request) LinkedList(java.util.LinkedList) Function(org.apache.pulsar.functions.proto.Function) Producer(org.apache.pulsar.client.api.Producer) PulsarClient(org.apache.pulsar.client.api.PulsarClient) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.testng.annotations.Test)

Example 7 with Producer

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

the class SchedulerManagerTest method testScalingUp.

@Test
public void testScalingUp() throws Exception {
    List<Function.FunctionMetaData> functionMetaDataList = new LinkedList<>();
    long version = 5;
    Function.FunctionMetaData function1 = Function.FunctionMetaData.newBuilder().setFunctionConfig(Function.FunctionConfig.newBuilder().setName("func-1").setNamespace("namespace-1").setTenant("tenant-1").setParallelism(1)).setVersion(version).build();
    Function.FunctionMetaData function2 = Function.FunctionMetaData.newBuilder().setFunctionConfig(Function.FunctionConfig.newBuilder().setName("func-2").setNamespace("namespace-1").setTenant("tenant-1").setParallelism(1)).setVersion(version).build();
    functionMetaDataList.add(function1);
    functionMetaDataList.add(function2);
    doReturn(functionMetaDataList).when(functionMetaDataManager).getAllFunctionMetaData();
    // set assignments
    Function.Assignment assignment1 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function1).setInstanceId(0).build()).build();
    Map<String, Map<String, Function.Assignment>> currentAssignments = new HashMap<>();
    Map<String, Function.Assignment> assignmentEntry1 = new HashMap<>();
    assignmentEntry1.put(Utils.getFullyQualifiedInstanceId(assignment1.getInstance()), assignment1);
    currentAssignments.put("worker-1", assignmentEntry1);
    doReturn(currentAssignments).when(functionRuntimeManager).getCurrentAssignments();
    // set version
    doReturn(version).when(functionRuntimeManager).getCurrentAssignmentVersion();
    // single node
    List<MembershipManager.WorkerInfo> workerInfoList = new LinkedList<>();
    workerInfoList.add(MembershipManager.WorkerInfo.of("worker-1", "workerHostname-1", 5000));
    doReturn(workerInfoList).when(membershipManager).getCurrentMembership();
    // i am leader
    doReturn(true).when(membershipManager).isLeader();
    callSchedule();
    List<Invocation> invocations = getMethodInvocationDetails(producer, Producer.class.getMethod("sendAsync", Object.class));
    Assert.assertEquals(invocations.size(), 1);
    byte[] send = (byte[]) invocations.get(0).getRawArguments()[0];
    Request.AssignmentsUpdate assignmentsUpdate = Request.AssignmentsUpdate.parseFrom(send);
    log.info("assignmentsUpdate: {}", assignmentsUpdate);
    Function.Assignment assignment2 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function2).setInstanceId(0).build()).build();
    Assert.assertEquals(assignmentsUpdate, Request.AssignmentsUpdate.newBuilder().setVersion(version + 1).addAssignments(assignment1).addAssignments(assignment2).build());
    // scale up
    PulsarClient pulsarClient = mock(PulsarClient.class);
    doReturn(producer).when(pulsarClient).createProducer(any(), any());
    Function.FunctionMetaData function2Scaled = Function.FunctionMetaData.newBuilder().setFunctionConfig(Function.FunctionConfig.newBuilder().setName("func-2").setNamespace("namespace-1").setTenant("tenant-1").setParallelism(3)).setVersion(version).build();
    functionMetaDataList = new LinkedList<>();
    functionMetaDataList.add(function1);
    functionMetaDataList.add(function2Scaled);
    doReturn(functionMetaDataList).when(functionMetaDataManager).getAllFunctionMetaData();
    Function.Assignment assignment2Scaled1 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function2Scaled).setInstanceId(0).build()).build();
    Function.Assignment assignment2Scaled2 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function2Scaled).setInstanceId(1).build()).build();
    Function.Assignment assignment2Scaled3 = Function.Assignment.newBuilder().setWorkerId("worker-1").setInstance(Function.Instance.newBuilder().setFunctionMetaData(function2Scaled).setInstanceId(2).build()).build();
    callSchedule();
    invocations = getMethodInvocationDetails(producer, Producer.class.getMethod("sendAsync", Object.class));
    Assert.assertEquals(invocations.size(), 2);
    send = (byte[]) invocations.get(1).getRawArguments()[0];
    assignmentsUpdate = Request.AssignmentsUpdate.parseFrom(send);
    Assert.assertEquals(assignmentsUpdate, Request.AssignmentsUpdate.newBuilder().setVersion(version + 1 + 1).addAssignments(assignment1).addAssignments(assignment2Scaled1).addAssignments(assignment2Scaled2).addAssignments(assignment2Scaled3).build());
}
Also used : Invocation(org.mockito.invocation.Invocation) HashMap(java.util.HashMap) Request(org.apache.pulsar.functions.proto.Request) LinkedList(java.util.LinkedList) Function(org.apache.pulsar.functions.proto.Function) Producer(org.apache.pulsar.client.api.Producer) PulsarClient(org.apache.pulsar.client.api.PulsarClient) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.testng.annotations.Test)

Example 8 with Producer

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

the class SchedulerManagerTest method setup.

@BeforeMethod
public void setup() throws PulsarClientException {
    WorkerConfig workerConfig = new WorkerConfig();
    workerConfig.setWorkerId("worker-1");
    workerConfig.setThreadContainerFactory(new WorkerConfig.ThreadContainerFactory().setThreadGroupName("test"));
    workerConfig.setPulsarServiceUrl("pulsar://localhost:6650");
    workerConfig.setStateStorageServiceUrl("foo");
    workerConfig.setFunctionAssignmentTopicName("assignments");
    workerConfig.setSchedulerClassName(RoundRobinScheduler.class.getName());
    workerConfig.setAssignmentWriteMaxRetries(0);
    producer = mock(Producer.class);
    completableFuture = spy(new CompletableFuture<>());
    completableFuture.complete(MessageId.earliest);
    byte[] bytes = any();
    when(producer.sendAsync(bytes)).thenReturn(completableFuture);
    PulsarClient pulsarClient = mock(PulsarClient.class);
    doReturn(producer).when(pulsarClient).createProducer(any(), any());
    schedulerManager = spy(new SchedulerManager(workerConfig, pulsarClient));
    functionRuntimeManager = mock(FunctionRuntimeManager.class);
    functionMetaDataManager = mock(FunctionMetaDataManager.class);
    membershipManager = mock(MembershipManager.class);
    schedulerManager.setFunctionMetaDataManager(functionMetaDataManager);
    schedulerManager.setFunctionRuntimeManager(functionRuntimeManager);
    schedulerManager.setMembershipManager(membershipManager);
}
Also used : RoundRobinScheduler(org.apache.pulsar.functions.worker.scheduler.RoundRobinScheduler) CompletableFuture(java.util.concurrent.CompletableFuture) Producer(org.apache.pulsar.client.api.Producer) PulsarClient(org.apache.pulsar.client.api.PulsarClient) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 9 with Producer

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

the class FunctionsImpl method triggerFunction.

@POST
@Path("/{tenant}/{namespace}/{functionName}/trigger")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response triggerFunction(@PathParam("tenant") final String tenant, @PathParam("namespace") final String namespace, @PathParam("name") final String functionName, @FormDataParam("data") final String input, @FormDataParam("dataStream") final InputStream uploadedInputStream) {
    FunctionConfig functionConfig;
    // validate parameters
    try {
        validateTriggerRequestParams(tenant, namespace, functionName, input, uploadedInputStream);
    } catch (IllegalArgumentException e) {
        log.error("Invalid trigger function request @ /{}/{}/{}", tenant, namespace, functionName, e);
        return Response.status(Status.BAD_REQUEST).type(MediaType.APPLICATION_JSON).entity(new ErrorData(e.getMessage())).build();
    }
    FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();
    if (!functionMetaDataManager.containsFunction(tenant, namespace, functionName)) {
        log.error("Function in getFunction does not exist @ /{}/{}/{}", tenant, namespace, functionName);
        return Response.status(Status.NOT_FOUND).type(MediaType.APPLICATION_JSON).entity(new ErrorData(String.format("Function %s doesn't exist", functionName))).build();
    }
    FunctionMetaData functionMetaData = functionMetaDataManager.getFunctionMetaData(tenant, namespace, functionName);
    String inputTopicToWrite;
    if (functionMetaData.getFunctionConfig().getInputsList().size() > 0) {
        inputTopicToWrite = functionMetaData.getFunctionConfig().getInputsList().get(0);
    } else {
        inputTopicToWrite = functionMetaData.getFunctionConfig().getCustomSerdeInputs().entrySet().iterator().next().getKey();
    }
    String outputTopic = functionMetaData.getFunctionConfig().getOutput();
    Reader reader = null;
    Producer producer = null;
    try {
        if (outputTopic != null && !outputTopic.isEmpty()) {
            reader = worker().getClient().newReader().topic(outputTopic).startMessageId(MessageId.latest).create();
        }
        producer = worker().getClient().newProducer().topic(inputTopicToWrite).create();
        byte[] targetArray;
        if (uploadedInputStream != null) {
            targetArray = new byte[uploadedInputStream.available()];
            uploadedInputStream.read(targetArray);
        } else {
            targetArray = input.getBytes();
        }
        MessageId msgId = producer.send(targetArray);
        if (reader == null) {
            return Response.status(Status.OK).build();
        }
        long curTime = System.currentTimeMillis();
        long maxTime = curTime + 1000;
        while (curTime < maxTime) {
            Message msg = reader.readNext(10000, TimeUnit.MILLISECONDS);
            if (msg == null)
                break;
            if (msg.getProperties().containsKey("__pfn_input_msg_id__") && msg.getProperties().containsKey("__pfn_input_topic__")) {
                MessageId newMsgId = MessageId.fromByteArray(Base64.getDecoder().decode((String) msg.getProperties().get("__pfn_input_msg_id__")));
                if (msgId.equals(newMsgId) && msg.getProperties().get("__pfn_input_topic__").equals(inputTopicToWrite)) {
                    return Response.status(Status.OK).entity(msg.getData()).build();
                }
            }
            curTime = System.currentTimeMillis();
        }
        return Response.status(Status.REQUEST_TIMEOUT).build();
    } catch (Exception e) {
        return Response.status(Status.INTERNAL_SERVER_ERROR).build();
    } finally {
        if (reader != null) {
            reader.closeAsync();
        }
        if (producer != null) {
            producer.closeAsync();
        }
    }
}
Also used : FunctionConfig(org.apache.pulsar.functions.proto.Function.FunctionConfig) FunctionMetaData(org.apache.pulsar.functions.proto.Function.FunctionMetaData) Message(org.apache.pulsar.client.api.Message) Reader(org.apache.pulsar.client.api.Reader) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) Producer(org.apache.pulsar.client.api.Producer) FunctionMetaDataManager(org.apache.pulsar.functions.worker.FunctionMetaDataManager) ErrorData(org.apache.pulsar.common.policies.data.ErrorData) MessageId(org.apache.pulsar.client.api.MessageId) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes)

Example 10 with Producer

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

the class ProducerImpl method connectionOpened.

@Override
public void connectionOpened(final ClientCnx cnx) {
    // we set the cnx reference before registering the producer on the cnx, so if the cnx breaks before creating the
    // producer, it will try to grab a new cnx
    connectionHandler.setClientCnx(cnx);
    cnx.registerProducer(producerId, this);
    log.info("[{}] [{}] Creating producer on cnx {}", topic, producerName, cnx.ctx().channel());
    long requestId = client.newRequestId();
    cnx.sendRequestWithId(Commands.newProducer(topic, producerId, requestId, producerName, conf.isEncryptionEnabled(), metadata), requestId).thenAccept(pair -> {
        String producerName = pair.getLeft();
        long lastSequenceId = pair.getRight();
        // set the cnx pointer so that new messages will be sent immediately
        synchronized (ProducerImpl.this) {
            if (getState() == State.Closing || getState() == State.Closed) {
                // Producer was closed while reconnecting, close the connection to make sure the broker
                // drops the producer on its side
                cnx.removeProducer(producerId);
                cnx.channel().close();
                return;
            }
            resetBackoff();
            log.info("[{}] [{}] Created producer on cnx {}", topic, producerName, cnx.ctx().channel());
            connectionId = cnx.ctx().channel().toString();
            connectedSince = DateFormatter.now();
            if (this.producerName == null) {
                this.producerName = producerName;
            }
            if (this.lastSequenceIdPublished == -1 && conf.getInitialSequenceId() == null) {
                this.lastSequenceIdPublished = lastSequenceId;
                this.msgIdGenerator = lastSequenceId + 1;
            }
            if (!producerCreatedFuture.isDone() && isBatchMessagingEnabled()) {
                // schedule the first batch message task
                client.timer().newTimeout(batchMessageAndSendTask, conf.getBatchingMaxPublishDelayMicros(), TimeUnit.MICROSECONDS);
            }
            resendMessages(cnx);
        }
    }).exceptionally((e) -> {
        Throwable cause = e.getCause();
        cnx.removeProducer(producerId);
        if (getState() == State.Closing || getState() == State.Closed) {
            // Producer was closed while reconnecting, close the connection to make sure the broker
            // drops the producer on its side
            cnx.channel().close();
            return null;
        }
        log.error("[{}] [{}] Failed to create producer: {}", topic, producerName, cause.getMessage());
        if (cause instanceof PulsarClientException.ProducerBlockedQuotaExceededException) {
            synchronized (this) {
                log.warn("[{}] [{}] Topic backlog quota exceeded. Throwing Exception on producer.", topic, producerName);
                if (log.isDebugEnabled()) {
                    log.debug("[{}] [{}] Pending messages: {}", topic, producerName, pendingMessages.size());
                }
                PulsarClientException bqe = new PulsarClientException.ProducerBlockedQuotaExceededException("Could not send pending messages as backlog exceeded");
                failPendingMessages(cnx(), bqe);
            }
        } else if (cause instanceof PulsarClientException.ProducerBlockedQuotaExceededError) {
            log.warn("[{}] [{}] Producer is blocked on creation because backlog exceeded on topic.", producerName, topic);
        }
        if (cause instanceof PulsarClientException.TopicTerminatedException) {
            setState(State.Terminated);
            failPendingMessages(cnx(), (PulsarClientException) cause);
            producerCreatedFuture.completeExceptionally(cause);
            client.cleanupProducer(this);
        } else if (// 
        producerCreatedFuture.isDone() || (cause instanceof PulsarClientException && connectionHandler.isRetriableError((PulsarClientException) cause) && System.currentTimeMillis() < createProducerTimeout)) {
            // Either we had already created the producer once (producerCreatedFuture.isDone()) or we are
            // still within the initial timeout budget and we are dealing with a retriable error
            reconnectLater(cause);
        } else {
            setState(State.Failed);
            producerCreatedFuture.completeExceptionally(cause);
            client.cleanupProducer(this);
        }
        return null;
    });
}
Also used : PulsarApi(org.apache.pulsar.common.api.proto.PulsarApi) CompressionCodec(org.apache.pulsar.common.compression.CompressionCodec) Commands.hasChecksum(org.apache.pulsar.common.api.Commands.hasChecksum) ByteBufPair(org.apache.pulsar.common.api.ByteBufPair) ScheduledFuture(io.netty.util.concurrent.ScheduledFuture) Producer(org.apache.pulsar.client.api.Producer) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) ProtocolVersion(org.apache.pulsar.common.api.proto.PulsarApi.ProtocolVersion) Message(org.apache.pulsar.client.api.Message) ChecksumType(org.apache.pulsar.common.api.Commands.ChecksumType) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) DateFormatter(org.apache.pulsar.common.util.DateFormatter) ByteBuf(io.netty.buffer.ByteBuf) Handle(io.netty.util.Recycler.Handle) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) CompressionCodecProvider(org.apache.pulsar.common.compression.CompressionCodecProvider) TimerTask(io.netty.util.TimerTask) MessageMetadata(org.apache.pulsar.common.api.proto.PulsarApi.MessageMetadata) Crc32cIntChecksum.resumeChecksum(com.scurrilous.circe.checksum.Crc32cIntChecksum.resumeChecksum) PulsarClientException(org.apache.pulsar.client.api.PulsarClientException) Crc32cIntChecksum.computeChecksum(com.scurrilous.circe.checksum.Crc32cIntChecksum.computeChecksum) PulsarDecoder(org.apache.pulsar.common.api.PulsarDecoder) CryptoException(org.apache.pulsar.client.api.PulsarClientException.CryptoException) Commands(org.apache.pulsar.common.api.Commands) Timeout(io.netty.util.Timeout) Logger(org.slf4j.Logger) Semaphore(java.util.concurrent.Semaphore) CompressionType(org.apache.pulsar.client.api.CompressionType) ProducerCryptoFailureAction(org.apache.pulsar.client.api.ProducerCryptoFailureAction) IOException(java.io.IOException) BlockingQueue(java.util.concurrent.BlockingQueue) AtomicLongFieldUpdater(java.util.concurrent.atomic.AtomicLongFieldUpdater) String.format(java.lang.String.format) ProducerConfigurationData(org.apache.pulsar.client.impl.conf.ProducerConfigurationData) Schema(org.apache.pulsar.client.api.Schema) Recycler(io.netty.util.Recycler) Commands.readChecksum(org.apache.pulsar.common.api.Commands.readChecksum) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Queues(com.google.common.collect.Queues) MessageId(org.apache.pulsar.client.api.MessageId) ReferenceCountUtil(io.netty.util.ReferenceCountUtil) Collections(java.util.Collections) PulsarClientException(org.apache.pulsar.client.api.PulsarClientException)

Aggregations

Producer (org.apache.pulsar.client.api.Producer)56 Test (org.testng.annotations.Test)47 Message (org.apache.pulsar.client.api.Message)39 Consumer (org.apache.pulsar.client.api.Consumer)36 ProducerConfiguration (org.apache.pulsar.client.api.ProducerConfiguration)32 ConsumerConfiguration (org.apache.pulsar.client.api.ConsumerConfiguration)29 PulsarClientException (org.apache.pulsar.client.api.PulsarClientException)20 IOException (java.io.IOException)18 ExecutionException (java.util.concurrent.ExecutionException)17 CompletableFuture (java.util.concurrent.CompletableFuture)16 MessageId (org.apache.pulsar.client.api.MessageId)16 Map (java.util.Map)14 PulsarClient (org.apache.pulsar.client.api.PulsarClient)13 CountDownLatch (java.util.concurrent.CountDownLatch)11 List (java.util.List)10 Future (java.util.concurrent.Future)10 TimeUnit (java.util.concurrent.TimeUnit)10 Lists (com.google.common.collect.Lists)9 ExecutorService (java.util.concurrent.ExecutorService)9 ConsumerImpl (org.apache.pulsar.client.impl.ConsumerImpl)9