use of org.jboss.netty.channel.DownstreamMessageEvent in project databus by linkedin.
the class SimpleDatabusRequest method sendDownstreamAsBinary.
@Override
public void sendDownstreamAsBinary(ChannelHandlerContext ctx, ChannelFuture future) {
ChannelBuffer buffer = toBinaryChannelBuffer();
ctx.sendDownstream(new DownstreamMessageEvent(ctx.getChannel(), future, buffer, ctx.getChannel().getRemoteAddress()));
}
use of org.jboss.netty.channel.DownstreamMessageEvent in project databus by linkedin.
the class MockServerChannelHandler method writeRequested.
@Override
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("<=<=<=<=WRite requested" + e.getMessage());
printMessage("<=<=<=<=", e);
}
MessageEvent newMessage = e;
if (_saveTheFuture) {
if (_future == null) {
// save the real future - so we can fail it
_future = e.getFuture();
// to make sure client's Netty thread will not get the update - we substitute a fake future
ChannelFuture newFuture = Channels.future(ctx.getChannel());
newMessage = new DownstreamMessageEvent(ctx.getChannel(), newFuture, e.getMessage(), e.getRemoteAddress());
if (LOG.isDebugEnabled())
LOG.debug("Saving the future:" + _future);
}
}
super.writeRequested(ctx, newMessage);
}
use of org.jboss.netty.channel.DownstreamMessageEvent in project databus by linkedin.
the class SimpleDatabusResponse method writeToChannelAsBinary.
@Override
public void writeToChannelAsBinary(ChannelHandlerContext ctx, ChannelFuture future) {
ChannelFuture realFuture = (null != future) ? future : Channels.future(ctx.getChannel());
ChannelBuffer serializedResponse = serializeToBinary();
DownstreamMessageEvent e = new DownstreamMessageEvent(ctx.getChannel(), realFuture, serializedResponse, ctx.getChannel().getRemoteAddress());
ctx.sendDownstream(e);
}
Aggregations