Skip to content

Commit

Permalink
deploy: 96bebb8
Browse files Browse the repository at this point in the history
  • Loading branch information
sauljabin committed Jul 12, 2024
1 parent 143c91c commit f487641
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
22 changes: 22 additions & 0 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,28 @@ <h3 id="protobuf-schema"><a class="header" href="#protobuf-schema">Protobuf Sche
string street = 3;
}
</code></pre>
<h3 id="configurations-1"><a class="header" href="#configurations-1">Configurations</a></h3>
<p>It is possible to produce with or without Schema Registry. It'll depend on the configurations.</p>
<p>Producer:</p>
<pre><code class="language-java">if (useSchemaRegistry) {
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, KafkaProtobufSerializer.class);
props.put(AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, "http://schema-registry:8081");
} else {
// ProtobufSerializer is a custom class
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ProtobufSerializer.class);
}
</code></pre>
<p>Consumer:</p>
<pre><code class="language-java">if (useSchemaRegistry) {
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, KafkaProtobufDeserializer.class);
props.put(AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, "http://schema-registry:8081");
} else {
// ProtobufDeserializer is a custom class
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ProtobufDeserializer.class);
// here we pass a custom configuration to the deserializer
props.put(ProtobufDeserializer.PROTOBUF_PARSER, Invoice.parser());
}
</code></pre>
<h3 id="setup-4"><a class="header" href="#setup-4">Setup</a></h3>
<p>Create a topic to produce protobuf messages <strong>without</strong> Schema Registry:</p>
<pre><code class="language-bash">kafka-topics --create --bootstrap-server kafka1:9092 \
Expand Down
22 changes: 22 additions & 0 deletions protobuf-producer-and-consumer.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,28 @@ <h3 id="protobuf-schema"><a class="header" href="#protobuf-schema">Protobuf Sche
string street = 3;
}
</code></pre>
<h3 id="configurations"><a class="header" href="#configurations">Configurations</a></h3>
<p>It is possible to produce with or without Schema Registry. It'll depend on the configurations.</p>
<p>Producer:</p>
<pre><code class="language-java">if (useSchemaRegistry) {
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, KafkaProtobufSerializer.class);
props.put(AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, "http://schema-registry:8081");
} else {
// ProtobufSerializer is a custom class
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ProtobufSerializer.class);
}
</code></pre>
<p>Consumer:</p>
<pre><code class="language-java">if (useSchemaRegistry) {
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, KafkaProtobufDeserializer.class);
props.put(AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, "http://schema-registry:8081");
} else {
// ProtobufDeserializer is a custom class
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ProtobufDeserializer.class);
// here we pass a custom configuration to the deserializer
props.put(ProtobufDeserializer.PROTOBUF_PARSER, Invoice.parser());
}
</code></pre>
<h3 id="setup"><a class="header" href="#setup">Setup</a></h3>
<p>Create a topic to produce protobuf messages <strong>without</strong> Schema Registry:</p>
<pre><code class="language-bash">kafka-topics --create --bootstrap-server kafka1:9092 \
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

0 comments on commit f487641

Please sign in to comment.