示例#1
0
        public async Task Execute()
        {
            var consumer = new RabbitMqConsumer(_rabbitUsername, _rabbitPassword, "/pay_queue", _rabbitHost);
            var factory  =
                new ImplFactoryDelegate <RequestServiceDefinition, RequestServiceImpl>(() => new RequestServiceImpl());
            var serv = new ServiceWrapper <RequestServiceDefinition, RequestServiceImpl>(consumer, factory);

            serv.Execute();
            await serv.CallAsync(async (reqServ, publisher) =>

                                 await reqServ.Create(publisher)
                                 );

            await consumer.WaitPoolFinished();
        }
示例#2
0
        public async Task Execute()
        {
            var consumer = new RabbitMqConsumer(_rabbitUsername, _rabbitPassword, "/pay_queue", _rabbitHost);
            var factory  =
                new ImplFactoryDelegate <ResponseServiceDefinition, ResponseServiceImpl>(() => new ResponseServiceImpl());
            var serv = new ServiceWrapper <ResponseServiceDefinition, ResponseServiceImpl>(consumer, factory,
                                                                                           (conf) =>
            {
                conf.UseErrorEventHandling(() => new ErrorHandler());
                conf.UseErrorCommandHandling(() => new ErrorHandler());
            });

            serv.Execute();
            await consumer.WaitPoolFinished();
        }