Код: Выделить всё
public EventHubProducerService(
@Value("${EVENTHUB_CONNECTION_STRING}") String connectionString,
@Value("${eventhub.name}") String eventHubName,
@Value("${schema-registry.endpoint}") String schemaRegistryEndpoint,
@Value("${schema-registry.group}") String schemaRegistryGroup) {
tokenCredential = new DefaultAzureCredentialBuilder().build();
this.producerClient = new EventHubClientBuilder()
.connectionString(connectionString, eventHubName)
.buildProducerClient();
SchemaRegistryAsyncClient schemaRegistryClient = new SchemaRegistryClientBuilder()
.credential(tokenCredential)
.fullyQualifiedNamespace(schemaRegistryEndpoint)
.buildAsyncClient();
this.schemaRegistryApacheAvroSerializer = new SchemaRegistryApacheAvroSerializerBuilder()
.schemaRegistryClient(schemaRegistryClient)
.schemaGroup(schemaRegistryGroup)
.autoRegisterSchemas(true)
.avroSpecificReader(true)
.buildSerializer();
}
public void sendMessage(AgreementLifecycleDomainSourceType message) {
EventData eventData = schemaRegistryApacheAvroSerializer.serialize(
message, TypeReference.createInstance(EventData.class)
);
SendOptions sendOptions = new SendOptions().setPartitionId("1");
producerClient.send(Collections.singletonList(eventData), sendOptions);
}
< /code>
Когда я подключаю этот концентратор событий к Microsoft Fabric EventReam и пытаюсь просмотреть данные, я получаю эту ошибку: < /p>
Source 'EventHubInputAdapter' had occurrences of kind 'InputDeserializerError.InvalidData'.
Invalid Avro Format.
Подробнее здесь: https://stackoverflow.com/questions/794 ... ventstream