小编Rod*_*lli的帖子

为什么这个 .c 文件 #include 本身?

为什么这个.c文件#include本身?

vsimple.c

#define USIZE 8
#include "vsimple.c"
#undef USIZE

#define USIZE 16
#include "vsimple.c"
#undef USIZE

#define USIZE 32
#include "vsimple.c"
#undef USIZE

#define USIZE 64
#include "vsimple.c"
#undef USIZE
Run Code Online (Sandbox Code Playgroud)

c c-preprocessor

53
推荐指数
2
解决办法
8042
查看次数

错误序列化 Avro 消息 - Kafka Schema Registry

我正在创建一个包含字符串和地图作为字段的 avro 类。我可以通过 maven 生成 avro 类,并且我能够在 localhost:8081 中创建一个注册表

.avsc 文件:

    {
"type":"record",
"name":"AvroClass",
"namespace":"belliPack.avro",
"fields":[
{
"name":"title",
"type":"string"
},
{
"name":"map",
"type": {"type": "map", "values": "double"}
}
]
}
Run Code Online (Sandbox Code Playgroud)

模式注册表返回: $ curl -X GET http://localhost:8081/subjects/teste1-value/versions/1

{"subject":"teste1-value","version":1,"id":42,"schema":"{"type":"record","name":"AvroClass","namespace":"belliPack.avro","fields":[{"name":"title","type":"string"},{"name":"map","type":{"type":"map","values":"double"}}]}"}
Run Code Online (Sandbox Code Playgroud)

我的卡夫卡制作人课程是:

public KafkaProducer<String, AvroClass> createKafkaProducer() {
    String bootstrapServer = "127.0.0.1:9092";
    String schemaRegistryURL = "127.0.0.1:8081";

    //create Producer properties
    Properties properties = new Properties();
    //kafka documentation>producer configs
    properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServer);
    properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
    properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, KafkaAvroSerializer.class.getName());
    properties.setProperty(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG,schemaRegistryURL);

    //create producer
    KafkaProducer<String, AvroClass> producer = new KafkaProducer<>(properties);
    return producer;
} …
Run Code Online (Sandbox Code Playgroud)

java avro apache-kafka confluent-schema-registry

1
推荐指数
1
解决办法
3033
查看次数