0

I have a following schema (.avsc file)

{
  "namespace": "com.avaya.mts",
  "type": "record",
  "name": "MultiTenancyOrgDataMessage",
  "fields": [
    {
      "name": "eventType",
      "type": [
        "null",
        {
          "type": "enum",
          "name": "TenantMessageType",
          "symbols": [
            "TENANT_ADDED",
            "TENANT_UPDATED",
            "TENANT_DELETED"
          ]
        }
      ],
      "doc": "Event type"
    },
    {
      "name": "timestamp",
      "type": "long",
      "doc": "Timestamp of the operation"
    },
    {
      "name": "tenantId",
      "type": "string",
      "doc": "Six digit unique tenant identifier"
    },
    {
      "name": "data",
      "type": [
        "null",
        {
          "type": "record",
          "name": "TenantData",
          "fields": [
            {
              "name": "name",
              "type": "string",
              "doc": "Tenant name"
            },
            {
              "name": "tenantId",
              "type": "string",
              "doc": "Six digit unique tenant identifier"
            },
            {
              "name": "loginDomain",
              "type": "string",
              "doc": "Login domain name"
            },
            {
              "name": "level",
              "type": [
                "null",
                "string"
              ],
              "doc": "OrganizationNode Level"
            },
            {
              "name": "key",
              "type": [
                "null",
                "string"
              ],
              "doc": "String tenant identifier"
            },
            {
              "name": "organizationNodeId",
              "type": [
                "null",
                "string"
              ],
              "doc": "Six digit unique orgnaization node identifier. Same as tenantId"
            },
            {
              "name": "organizationHierarchy",
              "type": [
                "null",
                "string"
              ],
              "doc": "Full hierarchy path of the orgnaization node"
            },
            {
              "name": "features",
              "type": [
                "null",
                "string"
              ]
            },
            {
              "name": "type",
              "type": [
                "null",
                {
                  "type": "enum",
                  "name": "OrganizationNodeType",
                  "symbols": [
                    "TENANT",
                    "DEFAULT"
                  ]
                }
              ],
              "doc": "Organization node type to differentiate between tenant and tenant hierarchy node"
            },
            {
              "name": "orgLevels",
              "type": [
                "null",
                {
                  "type": "array",
                  "items": {
                    "type": "record",
                    "name": "OrgLevel",
                    "fields": [
                      {
                        "name": "name",
                        "type": "string"
                      },
                      {
                        "name": "position",
                        "type": "int"
                      }
                    ]
                  }
                }
              ],
              "doc": "Name of the organization node level"
            },
            {
              "name": "solutionTemplates",
              "type": [
                "null",
                {
                  "type": "record",
                  "name": "SolutionTemplate",
                  "fields": [
                    {
                      "name": "templateId",
                      "type": "string",
                      "doc": "Six digit unique solution template identifier"
                    },
                    {
                      "name": "name",
                      "type": "string",
                      "doc": "Solution template name"
                    },
                    {
                      "name": "description",
                      "type": [
                        "null",
                        "string"
                      ],
                      "doc": "Solution template description"
                    }
                  ]
                }
              ],
              "doc": "Solution template associated with the organization node"
            },
            {
              "name": "profiles",
              "type": [
                "null",
                {
                  "type": "array",
                  "items": {
                    "type": "record",
                    "name": "Profile",
                    "fields": [
                      {
                        "name": "profileId",
                        "type": "string",
                        "doc": "Six digit unique profile identifier"
                      },
                      {
                        "name": "name",
                        "type": "string",
                        "doc": "Profile name"
                      },
                      {
                        "name": "description",
                        "type": [
                          "null",
                          "string"
                        ],
                        "doc": "Profile description"
                      }
                    ]
                  }
                }
              ],
              "doc": "Array of the profiles associated with organization node"
            },
            {
              "name": "tenantAttributes",
              "type": [
                "null",
                {
                  "type": "array",
                  "items": {
                    "type": "record",
                    "name": "TenantAttribute",
                    "fields": [
                      {
                        "name": "name",
                        "type": "string",
                        "doc": "Tenant attribute name"
                      },
                      {
                        "name": "value",
                        "type": "string",
                        "doc": "Tenant attribute value"
                      }
                    ]
                  }
                }
              ],
              "doc": "Array of tenant attributes"
            },
            {
              "name": "children",
              "type": [
                "null",
                {
                  "type": "array",
                  "items": {
                    "type": "record",
                    "name": "OrganizationNode",
                    "fields": [
                      {
                        "name": "name",
                        "type": [
                          "null",
                          "string"
                        ],
                        "doc": "OrganizationNode name"
                      },
                      {
                        "name": "type",
                        "type": [
                          "null",
                          "OrganizationNodeType"
                        ],
                        "doc": "OrganizationNode Type"
                      },
                      {
                        "name": "level",
                        "type": [
                          "null",
                          "string"
                        ],
                        "doc": "OrganizationNode Level"
                      },
                      {
                        "name": "key",
                        "type": [
                          "null",
                          "string"
                        ],
                        "doc": "Unique string identifier for the organization node"
                      },
                      {
                        "name": "organizationNodeId",
                        "type": [
                          "null",
                          "string"
                        ],
                        "doc": "Six digit unique identifier for the ornagization node"
                      },
                      {
                        "name": "organizationHierarchy",
                        "type": [
                          "null",
                          "string"
                        ],
                        "doc": "Full organizationNode hierarchy path"
                      },
                      {
                        "name": "features",
                        "type": [
                          "null",
                          "string"
                        ],
                        "doc": "This contains the feature details associated with tenants."
                      },
                      {
                        "name": "solutionTemplates",
                        "type": [
                          "null",
                          "SolutionTemplate"
                        ],
                        "doc": "Solution Template associated with the organization node"
                      },
                      {
                        "name": "profiles",
                        "type": [
                          "null",
                          {
                            "type": "array",
                            "items": "Profile"
                          }
                        ],
                        "doc": "Array of profiles associated with the organization node"
                      },
                      {
                        "name": "children",
                        "type": [
                          "null",
                          {
                            "type": "array",
                            "items": "OrganizationNode"
                          }
                        ],
                        "doc": "Child organization nodes"
                      }
                    ]
                  }
                }
              ]
            },
            {
              "name": "isDefault",
              "type": "boolean",
              "doc": "Flag only set to true for the default tenant"
            },
            {
              "name": "parent",
              "type": {
                "type": "record",
                "name": "Parent",
                "fields": [
                  {
                    "name": "tenantId",
                    "type": "string",
                    "doc": "Six digit unique tenant identifier for the parent node"
                  },
                  {
                    "name": "name",
                    "type": "string",
                    "doc": "Name of the parent node"
                  }
                ]
              },
              "doc": "Parent Organization Node"
            }
          ]
        }
      ]
    }
  ]
} 

And following is my sample json data

{
  "eventType": "TENANT_ADDED",
  "timestamp": 1442921557056,
  "tenantId": "GHIJKL",
  "data": {
    "name": "bmc",
    "type": "TENANT",
    "level": "Organization",
    "key": "bmc",
    "organizationNodeId": "VEKCPC",
    "organizationHierarchy": "bmc",
    "profiles": [],
    "children": [{
      "name": "Bangalore",
      "type": "DEFAULT",
      "level": "Site",
      "key": "Bangalore",
      "organizationNodeId": "OCNGVJ",
      "organizationHierarchy": "bmc/Bangalore",
      "features": "Test",
      "profiles": [{
        "description": "",
        "profileId": "MH985X",
        "name": "VoiceProfile"
      }],
      "children": [],
      "solutionTemplate": {
        "templateId": "FDASGG",
        "description": "Solution Template for site Banglore",
        "name": "TemplateSiteBanglore"
      }
    }, {
      "name": "Site_Pune",
      "type": "DEFAULT",
      "level": "Site",
      "key": "Site_Pune",
      "organizationNodeId": "DUQICJ",
      "organizationHierarchy": "bmc/Site_Pune",
      "profiles": [],
      "children": [],
      "solutionTemplate": {
        "templateId": "FDASWE",
        "description": "Template for site Pune",
        "templateName": "Template_Site_Pune"
      }
    }],
    "tenantAttributes": [],
    "tenantId": "VEKCPC",
    "orgLevels": [{
      "name": "Organization",
      "position": 1
    }, {
      "name": "Site",
      "position": 2
    }, {
      "name": "Department",
      "position": 3
    }, {
      "name": "Team",
      "position": 4
    }],
    "loginDomain": "bmc.com",
    "parent": {

      "tenantId": "HQAYQU",
      "name": "Default"
    },
    "solutionTemplates": {
      "templateId": "FDAGSA",
      "description": "Template for Tenant",
      "templateName": "Template_BMC"
    },
    "isDefault": false
  }
} 

While executing my JMeter to generate the avro event in kafka topic, I am getting an error

** Error Section **

2020-03-19 09:23:24,965 INFO o.a.j.e.StandardJMeterEngine: Running the test! 2020-03-19 09:23:24,965 INFO o.a.j.s.SampleEvent: List of sample_variables: [] 2020-03-19 09:23:24,966 INFO o.a.j.p.j.s.JavaSampler: Created class: com.gslab.pepper.sampler.PepperBoxKafkaSampler. Uses tearDownTest: 2020-03-19 09:23:24,966 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, local) 2020-03-19 09:23:25,114 INFO o.a.j.e.StandardJMeterEngine: No enabled thread groups found 2020-03-19 09:23:25,114 INFO o.a.j.e.StandardJMeterEngine: Starting tearDown thread groups 2020-03-19 09:23:25,114 INFO o.a.j.e.StandardJMeterEngine: Starting tearDown ThreadGroup: 1 : CreateTenant 2020-03-19 09:23:25,114 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group CreateTenant. 2020-03-19 09:23:25,114 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error 2020-03-19 09:23:25,115 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false 2020-03-19 09:23:25,115 INFO o.a.j.t.ThreadGroup: Started thread group number 1 2020-03-19 09:23:25,116 INFO o.a.j.t.JMeterThread: Thread started: CreateTenant 1-1 2020-03-19 09:23:25,530 ERROR o.a.j.t.JMeterThread: Test failed! org.apache.avro.AvroTypeException: Expected start-union. Got VALUE_STRING at org.apache.avro.io.JsonDecoder.error(JsonDecoder.java:514) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.io.JsonDecoder.readIndex(JsonDecoder.java:433) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:282) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:178) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:151) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.generic.GenericDatumReader.readField(GenericDatumReader.java:248) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:237) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:170) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:151) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:144) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at com.gslab.pepper.loadgen.impl.AvroSchemaLoadGenerator.nextMessage(AvroSchemaLoadGenerator.java:79) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at com.gslab.pepper.config.avroschema.AvroSchemaConfigElement.iterationStart(AvroSchemaConfigElement.java:67) ~[pepper-box-0.0.1-SNAPSHOT.jar:?] at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:399) ~[ApacheJMeter_core.jar:5.2.1] at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:391) ~[ApacheJMeter_core.jar:5.2.1] at org.apache.jmeter.control.GenericController.next(GenericController.java:160) ~[ApacheJMeter_core.jar:5.2.1] at org.apache.jmeter.control.LoopController.next(LoopController.java:135) ~[ApacheJMeter_core.jar:5.2.1] at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:92) ~[ApacheJMeter_core.jar:5.2.1] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:255) [ApacheJMeter_core.jar:5.2.1] at java.lang.Thread.run(Thread.java:834) [?:?] 2020-03-19 09:23:25,530 INFO o.a.j.t.JMeterThread: Thread finished: CreateTenant 1-1 2020-03-19 09:23:25,531 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test 2020-03-19 09:23:25,531 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, local)

Can someone please explain why exactly am I getting the error?

0 Answers0