private ByteBuf encryptMessage(MessageMetadata.Builder msgMetadata, ByteBuf compressedPayload) throws PulsarClientException { ByteBuf encryptedPayload = compressedPayload; if (!conf.isEncryptionEnabled() || msgCrypto == null) { return encryptedPayload; } try { encryptedPayload = msgCrypto.encrypt(conf.getEncryptionKeys(), conf.getCryptoKeyReader(), msgMetadata, compressedPayload); } catch (PulsarClientException e) { // Unless config is set to explicitly publish un-encrypted message upon failure, fail the request if (conf.getCryptoFailureAction() == ProducerCryptoFailureAction.SEND) { log.warn("[{}] [{}] Failed to encrypt message {}. Proceeding with publishing unencrypted message", topic, producerName, e.getMessage()); return compressedPayload; } throw e; } return encryptedPayload; }
topic, subscription, allTopicPartitionsNumber.get()); } catch (PulsarClientException e) { log.warn("[{}] Failed startReceivingMessages while subscribe topics: {}", topic, e.getMessage()); subscribeFuture.completeExceptionally(e); }})
private void close() { state = State.Closed; ctx.close(); try { client.close(); } catch (PulsarClientException e) { LOG.error("Unable to close pulsar client - {}. Error - {}", client, e.getMessage()); } }
topic, subscription, allTopicPartitionsNumber.get()); } catch (PulsarClientException e) { log.warn("[{}] Failed startReceivingMessages while subscribe topics: {}", topic, e.getMessage()); subscribeFuture.completeExceptionally(e); }})
private ByteBuf encryptMessage(MessageMetadata.Builder msgMetadata, ByteBuf compressedPayload) throws PulsarClientException { ByteBuf encryptedPayload = compressedPayload; if (!conf.isEncryptionEnabled() || msgCrypto == null) { return encryptedPayload; } try { encryptedPayload = msgCrypto.encrypt(conf.getEncryptionKeys(), conf.getCryptoKeyReader(), msgMetadata, compressedPayload); } catch (PulsarClientException e) { // Unless config is set to explicitly publish un-encrypted message upon failure, fail the request if (conf.getCryptoFailureAction() == ProducerCryptoFailureAction.SEND) { log.warn("[{}] [{}] Failed to encrypt message {}. Proceeding with publishing unencrypted message", topic, producerName, e.getMessage()); return compressedPayload; } throw e; } return encryptedPayload; }