-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Labels
ClientThis issue points to a problem in the data-plane of the library.This issue points to a problem in the data-plane of the library.Event HubsMessagingMessaging crewMessaging crewSchema RegistrybugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.issue-addressedWorkflow: The Azure SDK team believes it to be addressed and ready to close.Workflow: The Azure SDK team believes it to be addressed and ready to close.
Description
Describe the bug
The new 1.0.0b3 azure.schemaregistry.serializer.avroserializer seems to not work with the new example
here is the code
from azure.eventhub import EventHubProducerClient, EventData
from azure.schemaregistry import SchemaRegistryClient
from azure.schemaregistry.serializer.avroserializer import AvroSerializer
from azure.identity import DefaultAzureCredential
token_credential = DefaultAzureCredential()
fully_qualified_namespace = os.environ['my_namespace']
group_name = "rfframe"
eventhub_connection_str = os.environ['CONNECTION_STRING']
eventhub_name = 'rfinfo'
schema_string = """
{"namespace": "example.avro",
"type": "record",
"name": "User",
"fields": [
{"name": "name", "type": "string"},
{"name": "favorite_number", "type": ["int", "null"]},
{"name": "favorite_color", "type": ["string", "null"]}
]
}"""
schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, token_credential)
avro_serializer = AvroSerializer(client=schema_registry_client, group_name=group_name)
eventhub_producer = EventHubProducerClient.from_connection_string(
conn_str=eventhub_connection_str,
eventhub_name=eventhub_name
)
with eventhub_producer, avro_serializer:
event_data_batch = eventhub_producer.create_batch()
dict_data = {"name": "Bob", "favorite_number": 7, "favorite_color": "red"}
payload_bytes = avro_serializer.serialize(dict_data, schema=schema_string)
event_data_batch.add(EventData(body=payload_bytes))
eventhub_producer.send_batch(event_data_batch)
The eventhub is also present
the error message is this
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ClientThis issue points to a problem in the data-plane of the library.This issue points to a problem in the data-plane of the library.Event HubsMessagingMessaging crewMessaging crewSchema RegistrybugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.issue-addressedWorkflow: The Azure SDK team believes it to be addressed and ready to close.Workflow: The Azure SDK team believes it to be addressed and ready to close.

