基于主题的高性能、可靠无代理UDP消息传递(“事件总线”)。可承受每秒高达700万个70字节的消息。
实现 NAK协议所需的缓冲区不受影响,因此对GC的影响不大。如果配置得当,能保证可靠、有边界的低延迟。
要求JDK1.7或更高版本
示例代码
基于快速序列化的对象组播(=广播)发布者:
public static void mai(Strig arg[]) { FastCast.getFastCast().setNodeId("PUB"); // 5 chars MAX !! cofigureFastCast(); FCPublisher pub = FastCast.getFastCast().oTrasport("default").publish( ew PublisherCof(1) // uique-per-trasport topic id .umPacketHistory(40_000) // uber of packets kept for retrasmissio requests .pps(5000) // packets per secod rate limit. So max traffic for topic = 5000*2500 = 12.5 MB/secod ); // use a helper for fast-serialized messages ObjectPublisher opub = ew ObjectPublisher(pub); RateMeasure measure = ew RateMeasure("msg/s"); while( true ) { measure.cout(); opub.sedObject( ull, // all listeers should receive (by specifyig a odeId, a specific subscriber ca be targeted) "Hello "+System.curretTimeMillis(), // serializable object false // allow for 'batchig' several messages ito oe (will create slight latecy) ); } }
评论