Impl the send that pass a callback arg

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-09-16 22:12:26 -03:00
parent 533e95b755
commit cdb638157d
1 changed files with 13 additions and 8 deletions

View File

@ -102,10 +102,8 @@ public class CloudEventsKafkaProducer<K, A extends Attributes, T> implements
}
@Override
public Future<RecordMetadata> send(ProducerRecord<K, CloudEvent<A, T>>
private ProducerRecord<K, byte[]> marshal(ProducerRecord<K, CloudEvent<A, T>>
event) {
Wire<byte[], String, byte[]> wire = marshal(() -> event.value());
Set<Header> headers = marshal(wire.getHeaders());
@ -121,17 +119,24 @@ public class CloudEventsKafkaProducer<K, A extends Attributes, T> implements
event.key(),
payload,
headers);
return producer.send(record);
return record;
}
@Override
public Future<RecordMetadata> send(ProducerRecord<K, CloudEvent<A, T>>
event) {
return producer.send(marshal(event));
}
@Override
public Future<RecordMetadata> send(ProducerRecord<K, CloudEvent<A, T>>
event, Callback callback) {
// TODO Auto-generated method stub
return null;
return producer.send(marshal(event), callback);
}
@Override