// Path: src/main/java/com/github/milenkovicm/kafka/protocol/Acknowledgment.java
// public enum Acknowledgment {
// 
//     WAIT_FOR_ALL_REPLICAS(-1), WAIT_FOR_NO_ONE(0), WAIT_FOR_LEADER(1);
// 
//     public final int value;
// 
//     Acknowledgment(int value) {
//         this.value = value;
//     }
// 
// }
// 
// Path: src/main/java/com/github/milenkovicm/kafka/util/BackoffStrategy.java
// public abstract class BackoffStrategy {
//     abstract public boolean handle(Channel channel, ByteBuf key, ByteBuf message);
// }
// 
// Path: src/main/java/com/github/milenkovicm/kafka/util/DropBackoffStrategy.java
// public class DropBackoffStrategy extends BackoffStrategy {
// 
//     @Override
//     public boolean handle(Channel channel, ByteBuf key, ByteBuf message) {
//         if (key != null) {
//             key.release();
//         }
//         if (message != null) {
//             message.release();
//         }
// 
//         return true;
//     }
// }


import com.github.milenkovicm.kafka.protocol.Acknowledgment;
import com.github.milenkovicm.kafka.util.BackoffStrategy;
import com.github.milenkovicm.kafka.util.DropBackoffStrategy;
import io.netty.buffer.ByteBufAllocator;
import io.netty.util.internal.PlatformDependent;
import java.util.Objects;
import java.util.concurrent.ConcurrentMap;
/*
 * Copyright 2015 Marko Milenkovic (http://github.com/milenkovicm)
 *
 * 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.github.milenkovicm.kafka;



// https://kafka.apache.org/documentation.html#producerconfigs
public class ProducerProperties {

    public static final ProducerProperty<String> PRODUCER_ID = new ProducerProperty<>("default");
    public static final ProducerProperty<Integer> TIMEOUT = new ProducerProperty<>(1000);
    public static final ProducerProperty<Partitioner> PARTITIONER = new ProducerProperty<>((Partitioner) new DefaultPartitioner());
    public static final ProducerProperty<Acknowledgment> DATA_ACK = new ProducerProperty<>(Acknowledgment.WAIT_FOR_LEADER);
    public static final ProducerProperty<Integer> RETRY_BACKOFF = new ProducerProperty<>(500);
    //public static final ProducerProperty<Integer> TOPIC_METADATA_REFRESH = new ProducerProperty<>(600 * 1000);
    public static final ProducerProperty<Boolean> NETTY_DEBUG_PIPELINE = new ProducerProperty<>(Boolean.FALSE);
    public static final ProducerProperty<Integer> NETTY_HIGH_WATERMARK = new ProducerProperty<>(100_000_000);
    public static final ProducerProperty<Integer> NETTY_LOW_WATERMARK = new ProducerProperty<>(80_000_000);
    public static final ProducerProperty<Integer> NETTY_THREAD_COUNT = new ProducerProperty<>(Runtime.getRuntime().availableProcessors()*2);
    public static final ProducerProperty<Boolean> NETTY_HANDLER_COMPOSITE = new ProducerProperty<>(Boolean.FALSE);
    public static final ProducerProperty<ByteBufAllocator> NETTY_BYTE_BUF_ALLOCATOR = new ProducerProperty<>(ByteBufAllocator.DEFAULT);
// Path: src/main/java/com/github/milenkovicm/kafka/protocol/Acknowledgment.java
// public enum Acknowledgment {
// 
//     WAIT_FOR_ALL_REPLICAS(-1), WAIT_FOR_NO_ONE(0), WAIT_FOR_LEADER(1);
// 
//     public final int value;
// 
//     Acknowledgment(int value) {
//         this.value = value;
//     }
// 
// }
// 
// Path: src/main/java/com/github/milenkovicm/kafka/util/BackoffStrategy.java
// public abstract class BackoffStrategy {
//     abstract public boolean handle(Channel channel, ByteBuf key, ByteBuf message);
// }
// 
// Path: src/main/java/com/github/milenkovicm/kafka/util/DropBackoffStrategy.java
// public class DropBackoffStrategy extends BackoffStrategy {
// 
//     @Override
//     public boolean handle(Channel channel, ByteBuf key, ByteBuf message) {
//         if (key != null) {
//             key.release();
//         }
//         if (message != null) {
//             message.release();
//         }
// 
//         return true;
//     }
// }


// Path: src/main/java/com/github/milenkovicm/kafka/ProducerProperties.java
import com.github.milenkovicm.kafka.protocol.Acknowledgment;
import com.github.milenkovicm.kafka.util.BackoffStrategy;
import com.github.milenkovicm.kafka.util.DropBackoffStrategy;
import io.netty.buffer.ByteBufAllocator;
import io.netty.util.internal.PlatformDependent;
import java.util.Objects;
import java.util.concurrent.ConcurrentMap;

/*
 * Copyright 2015 Marko Milenkovic (http://github.com/milenkovicm)
 *
 * 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.github.milenkovicm.kafka;



// https://kafka.apache.org/documentation.html#producerconfigs
public class ProducerProperties {

    public static final ProducerProperty<String> PRODUCER_ID = new ProducerProperty<>("default");
    public static final ProducerProperty<Integer> TIMEOUT = new ProducerProperty<>(1000);
    public static final ProducerProperty<Partitioner> PARTITIONER = new ProducerProperty<>((Partitioner) new DefaultPartitioner());
    public static final ProducerProperty<Acknowledgment> DATA_ACK = new ProducerProperty<>(Acknowledgment.WAIT_FOR_LEADER);
    public static final ProducerProperty<Integer> RETRY_BACKOFF = new ProducerProperty<>(500);
    //public static final ProducerProperty<Integer> TOPIC_METADATA_REFRESH = new ProducerProperty<>(600 * 1000);
    public static final ProducerProperty<Boolean> NETTY_DEBUG_PIPELINE = new ProducerProperty<>(Boolean.FALSE);
    public static final ProducerProperty<Integer> NETTY_HIGH_WATERMARK = new ProducerProperty<>(100_000_000);
    public static final ProducerProperty<Integer> NETTY_LOW_WATERMARK = new ProducerProperty<>(80_000_000);
    public static final ProducerProperty<Integer> NETTY_THREAD_COUNT = new ProducerProperty<>(Runtime.getRuntime().availableProcessors()*2);
    public static final ProducerProperty<Boolean> NETTY_HANDLER_COMPOSITE = new ProducerProperty<>(Boolean.FALSE);
    public static final ProducerProperty<ByteBufAllocator> NETTY_BYTE_BUF_ALLOCATOR = new ProducerProperty<>(ByteBufAllocator.DEFAULT);
    public static final ProducerProperty<BackoffStrategy> BACKOFF_STRATEGY = new ProducerProperty<>((BackoffStrategy) new DropBackoffStrategy());