pl.allegro.tech.hermes.common.message.wrapper.UnwrappedMessageContent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-common Show documentation
Show all versions of hermes-common Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.common.message.wrapper;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.avro.Schema;
import pl.allegro.tech.hermes.schema.CompiledSchema;
import java.util.Optional;
@SuppressFBWarnings("EI_EXPOSE_REP2")
public class UnwrappedMessageContent {
private final MessageMetadata messageMetadata;
private final byte[] content;
private final Optional> schema;
public UnwrappedMessageContent(MessageMetadata messageMetadata, byte[] content) {
this.messageMetadata = messageMetadata;
this.content = content;
this.schema = Optional.empty();
}
public UnwrappedMessageContent(MessageMetadata messageMetadata, byte[] content, CompiledSchema schema) {
this.messageMetadata = messageMetadata;
this.content = content;
this.schema = Optional.of(schema);
}
public byte[] getContent() {
return content;
}
public MessageMetadata getMessageMetadata() {
return messageMetadata;
}
public Optional> getSchema() {
return schema;
}
}