本文整理了Java中kafka.message.Message.hasKey()
方法的一些代码示例,展示了Message.hasKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.hasKey()
方法的具体详情如下:
包路径:kafka.message.Message
类名称:Message
方法名:hasKey
暂无
代码示例来源:origin: pinterest/secor
topicPartition.getTopic(), topicPartition.getPartition()).iterator().next();
byte[] keyBytes = null;
if (messageAndOffset.message().hasKey()) {
ByteBuffer key = messageAndOffset.message().key();
keyBytes = new byte[key.limit()];
代码示例来源:origin: com.github.hackerwin7/jlib-utils
val = valBytes;
if(messageAndOffset.message().hasKey()) {
ByteBuffer keyBuffer = messageAndOffset.message().key();
byte[] keyBytes = new byte[keyBuffer.limit()];
代码示例来源:origin: HomeAdvisor/Kafdrop
private MessageVO createMessage(Message message, MessageDeserializer deserializer)
{
MessageVO vo = new MessageVO();
if (message.hasKey())
{
vo.setKey(ByteUtils.readString(message.key()));
}
if (!message.isNull())
{
final String messageString = deserializer.deserializeMessage(message.payload());
vo.setMessage(messageString);
}
vo.setValid(message.isValid());
vo.setCompressionCodec(message.compressionCodec().name());
vo.setChecksum(message.checksum());
vo.setComputedChecksum(message.computeChecksum());
return vo;
}
内容来源于网络,如有侵权,请联系作者删除!