Skip to content

help about creating record  #67

@masoudniki

Description

@masoudniki

hi
i was reading the document but I did not understand how to create a record and encode it according to the schema

    $avro = AvroSchema::parse(file_get_contents('./schemas/user.avsc'));
    $schemaRegistryClient=new CachedRegistry(
        new PromisingRegistry(
            new Client([
                'base_uri'=>"registry.example.com"
            ])
        ),
        new AvroObjectCacheAdapter()
    );
    $recordSerializer=new RecordSerializer($schemaRegistryClient,[
        RecordSerializer::OPTION_REGISTER_MISSING_SCHEMAS=>false,
        RecordSerializer::OPTION_REGISTER_MISSING_SUBJECTS=>false
    ]);
    $record=[];//how to create record ??
    $recordSerializer->encodeRecord('user_topic',$avro,$record);

can anybody explain to me how to create record like in java SDK?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions