Skip to content

Commit

Permalink
Merge pull request #222 from spelluru/patch-2
Browse files Browse the repository at this point in the history
first param should be byte[] - as per Eric Lam
  • Loading branch information
hmlam authored Nov 28, 2022
2 parents 436fdb4 + 4c34382 commit c7c395d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tutorials/interop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ and ByteArrayDeserializer:
// add other properties
properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class.getName());

final KafkaProducer<Long, byte[]> producer = new KafkaProducer<Long, byte[]>(properties);
final KafkaProducer<byte[], byte[]> producer = new KafkaProducer<byte[], byte[]>(properties);

final byte[] eventBody = new byte[] { 0x01, 0x02, 0x03, 0x04 };
ProducerRecord<Long, byte[]> pr =
new ProducerRecord<Long, byte[]>(myTopic, myPartitionId, myTimeStamp, eventBody);
ProducerRecord<byte[], byte[]> pr =
new ProducerRecord<byte[], byte[]>(myTopic, myPartitionId, myTimeStamp, eventBody);

/* send pr */
```
Expand All @@ -53,9 +53,9 @@ and ByteArrayDeserializer:
// add other properties
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());

final KafkaConsumer<Long, byte[]> consumer = new KafkaConsumer<Long, byte[]>(properties);
final KafkaConsumer<byte[], byte[]> consumer = new KafkaConsumer<byte[], byte[]>(properties);

ConsumerRecord<Long, byte[]> cr = /* receive event */
ConsumerRecord<byte[], byte[]> cr = /* receive event */
// cr.value() is a byte[] with values { 0x01, 0x02, 0x03, 0x04 }
```

Expand Down

0 comments on commit c7c395d

Please sign in to comment.