Spring boot 如何处理或创建从neo4j streams发出的kafka接收的数据的模型类?

Spring boot 如何处理或创建从neo4j streams发出的kafka接收的数据的模型类?,spring-boot,apache-kafka,neo4j,confluent-platform,Spring Boot,Apache Kafka,Neo4j,Confluent Platform,我试图理解卡夫卡的接收模型,它是从neo4j流发送到一个卡夫卡主题的 事实上,数据如下所示 { "meta": { "timestamp": 1608725179199, "username": "neo4j", "txId": 16443, "txEventId": 0, "txEventsCount": 1,

我试图理解卡夫卡的接收模型,它是从neo4j流发送到一个卡夫卡主题的

事实上,数据如下所示

{
  "meta": {
    "timestamp": 1608725179199,
    "username": "neo4j",
    "txId": 16443,
    "txEventId": 0,
    "txEventsCount": 1,
    "operation": "created",
    "source": {
      "hostname": "9945"
    }
  },
  "payload": {
    "id": "1000",
    "before": null,
    "after": {
      "properties": {
        "name": "sdfdf"
      },
      "labels": [
        "aaq"
      ]
    },
    "type": "node"
  },
  "schema": {
    "properties": {
      "name": "String"
    },
    "constraints": []
  }
}
所以,要在来自kafka的springboot中使用这种类型的复杂结构化数据,我们需要创建嵌套模型吗

我的意思是几乎有4个类相互嵌套

根据我的理解,我正在尝试创建以下类

meta (**This is 1st class**)
    "operation": "created",

payload(**This is 2ndclass which is nested inside the Meta**)
    id
    before
    after(**it is 3rd class which is nested to payload**)

        properties(**it is 4th class which is nested with in after**)
            these data only we needed to store
        labels
    type
事实上,我以前没有遇到过类似的嵌套问题,所以我不知道如何处理

那么,上述方法是正确的还是存在其他可能性

最终的目标是使用neo4j streams发出的卡夫卡主题的数据

语言:Java


框架:Springboot

您可以创建一个POJO。是的,它们是嵌套的。或者只使用JSONObject非常感谢@OneCricketer,我也在这么做。通过添加嵌套的POJO,这对我来说是可行的。几乎用了5-6个POJO类来形成一个消费者模型类。因此,仅寻找任何替代解决方案。例如,对于属性,您可以使用Hashmap,因为它可能不是严格定义的对象。否则,您可能能够提取Neo4j将使用的一些依赖项,这些依赖项实际上包括那些模型类。您可以创建一个POJO。是的,它们是嵌套的。或者只使用JSONObject非常感谢@OneCricketer,我也在这么做。通过添加嵌套的POJO,这对我来说是可行的。几乎用了5-6个POJO类来形成一个消费者模型类。因此,仅寻找任何替代解决方案。例如,对于属性,您可以使用Hashmap,因为它可能不是严格定义的对象。否则,您可能能够提取Neo4j将使用的一些依赖项,这些依赖项实际上包括那些模型类