org.eclipse.hono.application.client.kafka.KafkaMessageContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hono-client-application-kafka Show documentation
Show all versions of hono-client-application-kafka Show documentation
Clients for Hono's northbound Kafka-based APIs for implementing business applications
/*
* Copyright (c) 2021 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hono.application.client.kafka;
import java.util.Objects;
import org.eclipse.hono.application.client.MessageContext;
import io.vertx.core.buffer.Buffer;
import io.vertx.kafka.client.consumer.KafkaConsumerRecord;
/**
* The context of a Kafka message.
*
* It provides access to the {@link KafkaConsumerRecord}.
*/
public class KafkaMessageContext implements MessageContext {
private final KafkaConsumerRecord record;
/**
* Creates a context.
*
* @param record The consumer record from which the message is created.
* @throws NullPointerException if record is {@code null}.
*/
public KafkaMessageContext(final KafkaConsumerRecord record) {
Objects.requireNonNull(record);
this.record = record;
}
/**
* Gets the consumer record from which the message is created.
*
* @return The consumer record.
*/
public final KafkaConsumerRecord getRecord() {
return record;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy