@Override protected Message internalReceive(int timeout, TimeUnit unit) throws PulsarClientException { Message message; try { message = incomingMessages.poll(timeout, unit); if (message != null) { messageProcessed(message); } return message; } catch (InterruptedException e) { Thread.currentThread().interrupt(); stats.incrementNumReceiveFailed(); throw new PulsarClientException(e); } }
@Override protected Message internalReceive() throws PulsarClientException { if (conf.getReceiverQueueSize() == 0) { checkArgument(zeroQueueLock != null, "Receiver queue size can't be modified"); zeroQueueLock.writeLock().lock(); try { return fetchSingleMessageFromBroker(); } finally { zeroQueueLock.writeLock().unlock(); } } Message message; try { message = incomingMessages.take(); messageProcessed(message); return message; } catch (InterruptedException e) { Thread.currentThread().interrupt(); stats.incrementNumReceiveFailed(); throw new PulsarClientException(e); } }
} catch (InterruptedException e) { Thread.currentThread().interrupt(); stats.incrementNumReceiveFailed(); throw new PulsarClientException(e); } finally {
private void discardCorruptedMessage(MessageIdData messageId, ClientCnx currentCnx, ValidationError validationError) { log.error("[{}][{}] Discarding corrupted message at {}:{}", topic, subscription, messageId.getLedgerId(), messageId.getEntryId()); ByteBuf cmd = Commands.newAck(consumerId, messageId.getLedgerId(), messageId.getEntryId(), AckType.Individual, validationError); currentCnx.ctx().writeAndFlush(cmd, currentCnx.ctx().voidPromise()); increaseAvailablePermits(currentCnx); stats.incrementNumReceiveFailed(); }