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

io.zbus.mq.MessageCodec Maven / Gradle / Ivy

There is a newer version: 1.0.0-b1
Show newest version
package io.zbus.mq;

import java.util.List;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageCodec;


public class MessageCodec extends MessageToMessageCodec { 
	@Override
	protected void encode(ChannelHandlerContext ctx, Message msg, List out) throws Exception { 
		out.add(msg);
	}

	@Override
	protected void decode(ChannelHandlerContext ctx, Object obj, List out) throws Exception {
		if(obj instanceof io.zbus.transport.http.Message){
			Message msg = new Message((io.zbus.transport.http.Message)obj);
			out.add(msg);
		}
	} 
}