Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help about creating record #67

Open
masoudniki opened this issue Mar 12, 2022 · 0 comments
Open

help about creating record #67

masoudniki opened this issue Mar 12, 2022 · 0 comments

Comments

@masoudniki
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant