-
-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deserialize Protobuf messages using descriptor files
- Loading branch information
Taisiia Goltseva
committed
Nov 5, 2020
1 parent
3ebfd4b
commit 5ff02de
Showing
21 changed files
with
2,726 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.akhq.configs; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class TopicsMapping { | ||
String topicRegex; | ||
String descriptorFileBase64; | ||
String keyMessageType; | ||
String valueMessageType; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/org/akhq/repositories/CustomDeserializerRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.akhq.repositories; | ||
|
||
import org.akhq.modules.KafkaModule; | ||
import org.akhq.utils.ProtobufToJsonDeserializer; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@Singleton | ||
public class CustomDeserializerRepository { | ||
@Inject | ||
private KafkaModule kafkaModule; | ||
private final Map<String, ProtobufToJsonDeserializer> protobufToJsonDeserializers = new HashMap<>(); | ||
|
||
public ProtobufToJsonDeserializer getProtobufToJsonDeserializer(String clusterId) { | ||
if (!this.protobufToJsonDeserializers.containsKey(clusterId)) { | ||
this.protobufToJsonDeserializers.put( | ||
clusterId, | ||
new ProtobufToJsonDeserializer(this.kafkaModule.getConnection(clusterId).getDeserialization()) | ||
); | ||
} | ||
return this.protobufToJsonDeserializers.get(clusterId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.