예제 #1
0
        public static void Main(string[] args)
        {
            Core.CoreName = "PointCloud Core";
            //1.初始化核心
            Core core = Core.Instance;

            //2.使用注册
            core.Use((IOC) =>
            {
                IOC.Register <IRepository <EntityDemoIdentity, EntityDemo>, RepositoryDemo>(new object[] { 99999 }, Life.Singleton);
                IOC.Register <IEventStore, EventStoreDemo>(null, Life.Singleton, "Default", "EventStoreTest");
                IOC.Register <ApplicationService, ApplicationServiceDemo>();
                IOC.Register <IRPCInvoke, RPCInvoke>(new object[] { "127.0.0.1", 9001 }, Life.Scope, "RPC");
                IOC.Register <IRPCProxy, RPCProxy>(new object[] { "127.0.0.1", 9001 }, Life.Scope, "RPC");
            });
            //3.使用AMQP
            core.UseAMQP(() =>
            {
                RabbitModule module = new RabbitModule("MSI-SU", "suhuyuan", "localhost");
                module.Bind(".NETTest", ".NETTest", "1");
                return(module);
            });


            CreateHostBuilder(args).Build().Run();
        }
예제 #2
0
    public static ServiceCollection RegisterServices(ServiceCollection services)
    {
        RabbitModule.RegisterConsumer <TemperatureProcessor>(services);

        services.RegisterTemperatureListenerService();

        return(services);
    }
예제 #3
0
    public static void Main()
    {
        var services = new ServiceCollection();

        configuration = new ConfigurationBuilder()
                        .SetBasePath(Directory.GetParent(AppContext.BaseDirectory).FullName)
                        .AddJsonFile("appsettings.json", false)
                        .Build();

        services.AddSingleton <IConfiguration>(configuration);
        RabbitModule.RegisterPublisher <TestMessage>(services);
        _serviceProvider = services.BuildServiceProvider();
        var publisher = _serviceProvider.GetRequiredService <IStandardPublisher <TestMessage> >();

        publisher.Send(new TestMessage()
        {
            Value = "Howdy"
        });
    }
예제 #4
0
 public static ServiceCollection RegisterServices(ServiceCollection services)
 {
     RabbitModule.RegisterConsumer <DemoRabbitConsumer>(services);
     services.AddTransient <IJsonToObjectTranslator <TestMessage>, JsonToObjectTranslator <TestMessage> >();
     return(services);
 }
예제 #5
0
 public static ServiceCollection RegisterServices(ServiceCollection services)
 {
     RabbitModule.RegisterConsumer <HeartbeatProcessor>(services);
     services.RegisterHeartbeatListenerService();
     return(services);
 }