问题
I am using Spring Kafka and one of the topics contains messages with personal data. Is there any way I can configure Spring Kafka to automatically encrypt messages in a Producer/decrypt messages in a consumer or would I have to do it manually?
回答1:
There is nothing built into Spring or Kafka (although you can use SSL on the wire to prevent snooping.
For application-level encryption/decryption, you would need to implement it.
You can separate the concern from your business logic by using a ProducerInterceptor
and ConsumerInterceptor
(Kafka) or RecordInterceptor
(Spring).
来源:https://stackoverflow.com/questions/58717351/encrypting-and-decrypting-messages-with-spring-kafka