宠物六少,94xo,doyeah
一个基于 .net core 2.0 开发的简单易用的快速开发框架,遵循领域驱动设计(ddd)规范约束,提供实现事件驱动、事件回溯、响应式等特性的基础设施。让开发者享受到正真意义的面向对象设计模式来带的美感。
caching、dapperextensions、elasticsearch、eventbus、metrics、mongo、rabbitmq
pm> install-package linfx
public void configureservices(iservicecollection services) { services.addlinfx() .adddistributedrediscache(options => { options.configuration = configuration.getconnectionstring("reidsconnection"); }) .addmongodbcontext(options => { options.name = "default"; options.configuration = configuration.getconnectionstring("mongoconnection"); }) .addelasticsearch(options => { options.defaultindex = "default"; options.host = "http://10.0.1.112:9200"; }); }
using linfx.extensions.eventbus.abstractions; using linfx.test.extensions.eventbus.events; using linfx.utils; using linfx.extensions.eventbus.rabbitmq; using microsoft.extensions.dependencyinjection; using system.threading.tasks; using xunit; using linfx.test.extensions.eventbus.eventhandling; using system.collections.generic; using system; namespace linfx.test.extensions.eventbus { public class eventbusrabbitmqtest { private readonly ieventbus _eventbus; public eventbusrabbitmqtest() { var services = new servicecollection(); services.addlinfx() .addeventbus(options => { options.durable = true; options.brokername = "tc_cloud_event_bus"; options.queuename = "tc_cloud_process_queue"; options.configureeventbus = (fx, builder) => builder.userabbitmq(fx, x => { x.host = "14.21.34.85"; x.username = "admin"; x.password = "admin.123456"; }); }); //services services.addtransient<orderstatuschangedtoawaitingvalidationintegrationeventhandler>(); //services.addtransient<orderstatuschangedtopaidintegrationeventhandler>(); var applicationservices = services.buildserviceprovider(); //configureeventbus _eventbus = applicationservices.getrequiredservice<ieventbus>(); _eventbus.subscribe<orderstatuschangedtoawaitingvalidationintegrationevent, orderstatuschangedtoawaitingvalidationintegrationeventhandler>(); //eventbus.subscribe<orderstatuschangedtopaidintegrationevent, orderstatuschangedtopaidintegrationeventhandler>(); } [fact] public async task should_call_handler_on_event_with_correct_sourceasync() { var orderid = guid.newguid().gethashcode() & ushort.maxvalue; var evt = new orderstatuschangedtoawaitingvalidationintegrationevent(orderid, new list<orderstockitem> { }); await _eventbus.publishasync(evt); //for (int i = 0; i < 2; i++) //{ // await _eventbus.publishasync(new clientcreateintergrationevent // { // clientid = idutils.createnewid().tostring(), // clientsecrets = new[] { "191d437f0cc3463b85669f2b570cdc21" }, // allowedgranttypes = new[] { "client_credentials" }, // allowedscopes = new[] { "api3.device" } // }); //} } } }
github
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论