RobertIndie commented on a change in pull request #8962:
URL: https://github.com/apache/pulsar/pull/8962#discussion_r546561364



##########
File path: pulsar-client-shaded/pom.xml
##########
@@ -104,6 +104,7 @@
               <artifactSet>
                 <includes>
                   <include>org.apache.pulsar:pulsar-client-original</include>
+                  <include>org.apache.pulsar:pulsar-client-api</include>

Review comment:
       But if we don't include pulsar-client-api, some interfaces may not be 
relocated correctly.
   For example, in SimpleProducerConsumerTest:558:
   ```java
   MessageCrypto crypto = new MessageCryptoBc("test", false);
   PulsarApi.MessageMetadata.Builder metadataBuilder = 
PulsarApi.MessageMetadata.newBuilder();
   PulsarApi.EncryptionKeys.Builder encKeyBuilder = 
PulsarApi.EncryptionKeys.newBuilder();
   encKeyBuilder.setKey(encryptionKeyName);
   ByteString keyValue = ByteString.copyFrom(dataKey);
   encKeyBuilder.setValue(keyValue);
   PulsarApi.EncryptionKeys encKey = encKeyBuilder.build();
   metadataBuilder.setEncryptionParam(ByteString.copyFrom(encrParam));
   metadataBuilder.setEncryptionAlgo(encAlgo);
   metadataBuilder.setProducerName("test");
   metadataBuilder.setSequenceId(123);
   metadataBuilder.setPublishTime(12333453454L);
   metadataBuilder.addEncryptionKeys(encKey);
   
metadataBuilder.setCompression(CompressionCodecProvider.convertToWireProtocol(compressionType));
   metadataBuilder.setUncompressedSize(uncompressedSize);
   ByteBuf decryptedPayload = crypto.decrypt(() -> metadataBuilder.build(), 
payloadBuf, reader); 
   ```
   It will throw an error in the last line:
   `'decrypt(java.util.function.Supplier, io.netty.buffer.ByteBuf, 
org.apache.pulsar.client.api.CryptoKeyReader)' in 
'org.apache.pulsar.client.api.MessageCrypto' cannot be applied to '(<lambda 
expression>, org.apache.pulsar.shade.io.netty.buffer.ByteBuf, 
org.apache.pulsar.client.api.CryptoKeyReader)'`
   
   So we need to include pulsar-client-api to make
   ```
   io.netty.buffer.ByteBuf decrypt(java.util.function.Supplier<MetadataT> 
supplier, io.netty.buffer.ByteBuf byteBuf, 
org.apache.pulsar.client.api.CryptoKeyReader cryptoKeyReader);
   ```
   change to :
   ```
   org.apache.pulsar.shade.io.netty.buffer.ByteBuf 
decrypt(java.util.function.Supplier<MetadataT> supplier, 
org.apache.pulsar.shade.io.netty.buffer.ByteBuf byteBuf, 
org.apache.pulsar.client.api.CryptoKeyReader cryptoKeyReader);
   ```
   
   Currently, I haven't found another solution to solve this problem.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to