// Path: src/main/java/com/hubrick/vertx/kafka/producer/model/ByteKafkaMessage.java
// @DataObject(generateConverter = true)
// public class ByteKafkaMessage extends AbstractKafkaMessage {
// 
//     private Buffer payload;
// 
//     public ByteKafkaMessage() {
//     }
// 
//     public ByteKafkaMessage(Buffer payload) {
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = payload;
//     }
// 
//     public ByteKafkaMessage(Buffer payload, String partKey) {
//         super(partKey);
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = payload;
//     }
// 
//     public ByteKafkaMessage(ByteKafkaMessage byteKafkaMessage) {
//         super(byteKafkaMessage.getPartKey());
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = byteKafkaMessage.getPayload();
//     }
// 
//     public ByteKafkaMessage(JsonObject jsonObject) {
//         super(jsonObject.getString(PART_KEY));
//         this.payload = jsonObject.getBinary(PAYLOAD) != null ? Buffer.buffer(jsonObject.getBinary(PAYLOAD)) : null;
//     }
// 
//     public Buffer getPayload() {
//         return payload;
//     }
// 
//     public void setPayload(Buffer payload) {
//         this.payload = payload;
//     }
// 
//     public JsonObject toJson() {
//         final JsonObject jsonObject = super.asJson();
//         if (getPayload() != null) {
//             jsonObject.put(PAYLOAD, payload != null ? payload.getBytes() : null);
//         }
//         return jsonObject;
//     }
// }
// 
// Path: src/main/java/com/hubrick/vertx/kafka/producer/model/KafkaOptions.java
// @DataObject
// public class KafkaOptions {
// 
//     public static final String TOPIC = "topic";
// 
//     private String topic;
// 
//     public KafkaOptions() {}
// 
//     public KafkaOptions(KafkaOptions kafkaOptions) {
//         this.topic = kafkaOptions.getTopic();
//     }
// 
//     public KafkaOptions(JsonObject jsonObject) {
//         this.topic = jsonObject.getString(TOPIC);
//     }
// 
//     public String getTopic() {
//         return topic;
//     }
// 
//     @Fluent
//     public KafkaOptions setTopic(String topic) {
//         this.topic = topic;
//         return this;
//     }
// 
//     public JsonObject toJson() {
//         final JsonObject jsonObject = new JsonObject();
//         if(topic != null) {
//             jsonObject.put(TOPIC, topic);
//         }
//         return jsonObject;
//     }
// }
// 
// Path: src/main/java/com/hubrick/vertx/kafka/producer/model/StringKafkaMessage.java
// @DataObject
// public class StringKafkaMessage extends AbstractKafkaMessage {
// 
//     private String payload;
// 
//     public StringKafkaMessage() {
//     }
// 
//     public StringKafkaMessage(String payload) {
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = payload;
//     }
// 
//     public StringKafkaMessage(String payload, String partKey) {
//         super(partKey);
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = payload;
//     }
// 
//     public StringKafkaMessage(StringKafkaMessage stringKafkaMessage) {
//         super(stringKafkaMessage.getPartKey());
//         this.payload = stringKafkaMessage.getPayload();
//     }
// 
//     public StringKafkaMessage(JsonObject jsonObject) {
//         super(jsonObject.getString(PART_KEY));
//         this.payload = jsonObject.getString(PAYLOAD);
//     }
// 
//     public String getPayload() {
//         return payload;
//     }
// 
//     public void setPayload(String payload) {
//         this.payload = payload;
//     }
// 
//     public JsonObject toJson() {
//         final JsonObject jsonObject = super.asJson();
//         if (getPayload() != null) {
//             jsonObject.put(PAYLOAD, getPayload());
//         }
//         return jsonObject;
//     }
// }


import com.hubrick.vertx.kafka.producer.model.ByteKafkaMessage;
import com.hubrick.vertx.kafka.producer.model.KafkaOptions;
import com.hubrick.vertx.kafka.producer.model.StringKafkaMessage;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.annotations.ProxyGen;
import io.vertx.codegen.annotations.ProxyIgnore;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.DeliveryOptions;
import io.vertx.serviceproxy.ProxyHelper;
/**
 * Copyright (C) 2016 Etaia AS (oss@hubrick.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hubrick.vertx.kafka.producer;


/**
 * @author Emir Dizdarevic
 * @since 1.0.0
 */
@ProxyGen
public interface KafkaProducerService {

    static KafkaProducerService createProxy(Vertx vertx, String address) {
        return ProxyHelper.createProxy(KafkaProducerService.class, vertx, address);
    }

    static KafkaProducerService createProxyWithTimeout(Vertx vertx, String address, Long timeout) {
        return ProxyHelper.createProxy(KafkaProducerService.class, vertx, address, new DeliveryOptions().setSendTimeout(timeout));
    }

    @ProxyIgnore
    void start();

    @ProxyIgnore
    void stop();

    @ProxyIgnore
    @GenIgnore
    default void sendString(StringKafkaMessage message, Handler<AsyncResult<Void>> resultHandler) {
        sendString(message, new KafkaOptions(), resultHandler);
    }

    void sendString(StringKafkaMessage message, KafkaOptions options, Handler<AsyncResult<Void>> resultHandler);

    @ProxyIgnore
    @GenIgnore
// Path: src/main/java/com/hubrick/vertx/kafka/producer/model/ByteKafkaMessage.java
// @DataObject(generateConverter = true)
// public class ByteKafkaMessage extends AbstractKafkaMessage {
// 
//     private Buffer payload;
// 
//     public ByteKafkaMessage() {
//     }
// 
//     public ByteKafkaMessage(Buffer payload) {
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = payload;
//     }
// 
//     public ByteKafkaMessage(Buffer payload, String partKey) {
//         super(partKey);
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = payload;
//     }
// 
//     public ByteKafkaMessage(ByteKafkaMessage byteKafkaMessage) {
//         super(byteKafkaMessage.getPartKey());
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = byteKafkaMessage.getPayload();
//     }
// 
//     public ByteKafkaMessage(JsonObject jsonObject) {
//         super(jsonObject.getString(PART_KEY));
//         this.payload = jsonObject.getBinary(PAYLOAD) != null ? Buffer.buffer(jsonObject.getBinary(PAYLOAD)) : null;
//     }
// 
//     public Buffer getPayload() {
//         return payload;
//     }
// 
//     public void setPayload(Buffer payload) {
//         this.payload = payload;
//     }
// 
//     public JsonObject toJson() {
//         final JsonObject jsonObject = super.asJson();
//         if (getPayload() != null) {
//             jsonObject.put(PAYLOAD, payload != null ? payload.getBytes() : null);
//         }
//         return jsonObject;
//     }
// }
// 
// Path: src/main/java/com/hubrick/vertx/kafka/producer/model/KafkaOptions.java
// @DataObject
// public class KafkaOptions {
// 
//     public static final String TOPIC = "topic";
// 
//     private String topic;
// 
//     public KafkaOptions() {}
// 
//     public KafkaOptions(KafkaOptions kafkaOptions) {
//         this.topic = kafkaOptions.getTopic();
//     }
// 
//     public KafkaOptions(JsonObject jsonObject) {
//         this.topic = jsonObject.getString(TOPIC);
//     }
// 
//     public String getTopic() {
//         return topic;
//     }
// 
//     @Fluent
//     public KafkaOptions setTopic(String topic) {
//         this.topic = topic;
//         return this;
//     }
// 
//     public JsonObject toJson() {
//         final JsonObject jsonObject = new JsonObject();
//         if(topic != null) {
//             jsonObject.put(TOPIC, topic);
//         }
//         return jsonObject;
//     }
// }
// 
// Path: src/main/java/com/hubrick/vertx/kafka/producer/model/StringKafkaMessage.java
// @DataObject
// public class StringKafkaMessage extends AbstractKafkaMessage {
// 
//     private String payload;
// 
//     public StringKafkaMessage() {
//     }
// 
//     public StringKafkaMessage(String payload) {
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = payload;
//     }
// 
//     public StringKafkaMessage(String payload, String partKey) {
//         super(partKey);
//         checkNotNull(payload, "payload must not be null");
// 
//         this.payload = payload;
//     }
// 
//     public StringKafkaMessage(StringKafkaMessage stringKafkaMessage) {
//         super(stringKafkaMessage.getPartKey());
//         this.payload = stringKafkaMessage.getPayload();
//     }
// 
//     public StringKafkaMessage(JsonObject jsonObject) {
//         super(jsonObject.getString(PART_KEY));
//         this.payload = jsonObject.getString(PAYLOAD);
//     }
// 
//     public String getPayload() {
//         return payload;
//     }
// 
//     public void setPayload(String payload) {
//         this.payload = payload;
//     }
// 
//     public JsonObject toJson() {
//         final JsonObject jsonObject = super.asJson();
//         if (getPayload() != null) {
//             jsonObject.put(PAYLOAD, getPayload());
//         }
//         return jsonObject;
//     }
// }


// Path: src/main/java/com/hubrick/vertx/kafka/producer/KafkaProducerService.java
import com.hubrick.vertx.kafka.producer.model.ByteKafkaMessage;
import com.hubrick.vertx.kafka.producer.model.KafkaOptions;
import com.hubrick.vertx.kafka.producer.model.StringKafkaMessage;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.annotations.ProxyGen;
import io.vertx.codegen.annotations.ProxyIgnore;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.DeliveryOptions;
import io.vertx.serviceproxy.ProxyHelper;

/**
 * Copyright (C) 2016 Etaia AS (oss@hubrick.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hubrick.vertx.kafka.producer;


/**
 * @author Emir Dizdarevic
 * @since 1.0.0
 */
@ProxyGen
public interface KafkaProducerService {

    static KafkaProducerService createProxy(Vertx vertx, String address) {
        return ProxyHelper.createProxy(KafkaProducerService.class, vertx, address);
    }

    static KafkaProducerService createProxyWithTimeout(Vertx vertx, String address, Long timeout) {
        return ProxyHelper.createProxy(KafkaProducerService.class, vertx, address, new DeliveryOptions().setSendTimeout(timeout));
    }

    @ProxyIgnore
    void start();

    @ProxyIgnore
    void stop();

    @ProxyIgnore
    @GenIgnore
    default void sendString(StringKafkaMessage message, Handler<AsyncResult<Void>> resultHandler) {
        sendString(message, new KafkaOptions(), resultHandler);
    }

    void sendString(StringKafkaMessage message, KafkaOptions options, Handler<AsyncResult<Void>> resultHandler);

    @ProxyIgnore
    @GenIgnore
    default void sendBytes(ByteKafkaMessage message, Handler<AsyncResult<Void>> resultHandler) {