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

com.jeesuite.kafka.serializer.MessageDecoder Maven / Gradle / Ivy

package com.jeesuite.kafka.serializer;

import org.apache.kafka.common.serialization.Deserializer;

import com.jeesuite.common.serializer.SerializeUtils;

import kafka.serializer.Decoder;


/**
 * 
 * @description 
* @author vakin * @date 2016年6月14日 */ public class MessageDecoder implements Decoder { private Deserializer deserializer; public MessageDecoder() {} public MessageDecoder(Deserializer deserializer) { super(); this.deserializer = deserializer; } @Override public Object fromBytes(byte[] bytes) { if(deserializer != null)return deserializer.deserialize(null, bytes); return SerializeUtils.deserialize(bytes); } }