All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mageddo.kafka.client.DefaultCallbackContext Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package com.mageddo.kafka.client;

import java.util.Collections;

import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.MockConsumer;
import org.apache.kafka.clients.consumer.OffsetResetStrategy;

import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
import lombok.experimental.Accessors;

@Value
@Builder(toBuilder = true)
@Accessors(fluent = true)
public class DefaultCallbackContext implements CallbackContext {
  @NonNull
  private Consumer consumer;

  @NonNull
  private ConsumerRecords records;

  private ConsumerRecord record;

  public static DefaultCallbackContext NOP(){
    return DefaultCallbackContext
        .builder()
        .records(new ConsumerRecords<>(Collections.EMPTY_MAP))
        .consumer(new MockConsumer<>(OffsetResetStrategy.NONE))
        .build()
    ;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy