@@ -23,6 +23,15 @@ namespace Sample.RabbitMQ.MySql | |||||
y.UserName = "admin"; | y.UserName = "admin"; | ||||
y.Password = "123123"; | y.Password = "123123"; | ||||
}); | }); | ||||
x.UseDashboard(); | |||||
x.UseDiscovery(d => | |||||
{ | |||||
d.DiscoveryServerHostName = "localhost"; | |||||
d.DiscoveryServerProt = 8500; | |||||
d.CurrentNodeHostName = "localhost"; | |||||
d.CurrentNodePort = 5800; | |||||
d.NodeName = "CAP 1号节点"; | |||||
}); | |||||
}); | }); | ||||
services.AddMvc(); | services.AddMvc(); | ||||
@@ -36,6 +45,7 @@ namespace Sample.RabbitMQ.MySql | |||||
app.UseMvc(); | app.UseMvc(); | ||||
app.UseCap(); | app.UseCap(); | ||||
app.UseCapDashboard(); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -10,8 +10,8 @@ namespace Sample.RabbitMQ.SqlServer | |||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||||
{ | { | ||||
//optionsBuilder.UseSqlServer("Server=192.168.2.206;Initial Catalog=TestCap;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True"); | |||||
optionsBuilder.UseSqlServer("Server=DESKTOP-M9R8T31;Initial Catalog=Sample.Kafka.SqlServer;User Id=sa;Password=P@ssw0rd;MultipleActiveResultSets=True"); | |||||
optionsBuilder.UseSqlServer("Server=192.168.2.206;Initial Catalog=TestCap;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True"); | |||||
// optionsBuilder.UseSqlServer("Server=DESKTOP-M9R8T31;Initial Catalog=Sample.Kafka.SqlServer;User Id=sa;Password=P@ssw0rd;MultipleActiveResultSets=True"); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -61,7 +61,7 @@ namespace Sample.RabbitMQ.SqlServer.Controllers | |||||
return Ok(); | return Ok(); | ||||
} | } | ||||
[CapSubscribe("sample.rabbitmq.mysql33333")] | |||||
[CapSubscribe("sample.rabbitmq.mysql33333",Group ="Test.Group")] | |||||
public void KafkaTest22(Person person) | public void KafkaTest22(Person person) | ||||
{ | { | ||||
var aa = _dbContext.Database; | var aa = _dbContext.Database; | ||||
@@ -1,5 +1,6 @@ | |||||
using Microsoft.AspNetCore.Builder; | using Microsoft.AspNetCore.Builder; | ||||
using Microsoft.AspNetCore.Hosting; | using Microsoft.AspNetCore.Hosting; | ||||
using Microsoft.Extensions.Configuration; | |||||
using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; | ||||
using Microsoft.Extensions.Logging; | using Microsoft.Extensions.Logging; | ||||
using Sample.RabbitMQ.SqlServer.Services; | using Sample.RabbitMQ.SqlServer.Services; | ||||
@@ -19,8 +20,21 @@ namespace Sample.RabbitMQ.SqlServer | |||||
services.AddCap(x => | services.AddCap(x => | ||||
{ | { | ||||
x.UseEntityFramework<AppDbContext>(); | x.UseEntityFramework<AppDbContext>(); | ||||
x.UseRabbitMQ("localhost"); | |||||
x.UseRabbitMQ(z => | |||||
{ | |||||
z.HostName = "192.168.2.206"; | |||||
z.UserName = "admin"; | |||||
z.Password = "123123"; | |||||
}); | |||||
x.UseDashboard(); | x.UseDashboard(); | ||||
x.UseDiscovery(d => | |||||
{ | |||||
d.DiscoveryServerHostName = "localhost"; | |||||
d.DiscoveryServerProt = 8500; | |||||
d.CurrentNodeHostName = "localhost"; | |||||
d.CurrentNodePort = 5800; | |||||
d.NodeName = "CAP一号节点"; | |||||
}); | |||||
}); | }); | ||||
services.AddMvc(); | services.AddMvc(); | ||||