public void Setup() { IocHelper.AddTransient <IFlowMiddleware, InporcFlow>(); //ZMQ环境,与ZeroRpcFlow冲突,只用其一 IocHelper.AddTransient <IMessagePoster, InprocPoster>(); //采用ZMQ进程内通讯生产端 IocHelper.AddTransient <IMessageConsumer, InporcConsumer>(); //采用ZMQ进程内通讯生产端 IocHelper.AddTransient <IReceiverDiscory, TestDiscory>(); //网络协议发现 IocHelper.ServiceCollection.UseTest(typeof(RpcControler).Assembly); }
static async Task Main(string[] args) { IocHelper.AddTransient <IMessageConsumer, KafkaConsumer>(); ZeroApplication.CheckOption(); ZeroApplication.Discove(typeof(Program).Assembly); MessageProducer.Initialize(); ZeroApplication.Initialize(); MessageProducer.Publish("test1", "api/test", "{}"); await ZeroApplication.RunAwaiteAsync(); }