Browse Source

update sample.

master
yangxiaodong 7 years ago
parent
commit
e61186999d
4 changed files with 28 additions and 4 deletions
  1. +10
    -0
      samples/Sample.RabbitMQ.MySql/Startup.cs
  2. +2
    -2
      samples/Sample.RabbitMQ.SqlServer/AppDbContext.cs
  3. +1
    -1
      samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs
  4. +15
    -1
      samples/Sample.RabbitMQ.SqlServer/Startup.cs

+ 10
- 0
samples/Sample.RabbitMQ.MySql/Startup.cs View File

@@ -23,6 +23,15 @@ namespace Sample.RabbitMQ.MySql
y.UserName = "admin";
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();
@@ -36,6 +45,7 @@ namespace Sample.RabbitMQ.MySql
app.UseMvc();

app.UseCap();
app.UseCapDashboard();
}
}
}

+ 2
- 2
samples/Sample.RabbitMQ.SqlServer/AppDbContext.cs View File

@@ -10,8 +10,8 @@ namespace Sample.RabbitMQ.SqlServer

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");
}
}
}

+ 1
- 1
samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs View File

@@ -61,7 +61,7 @@ namespace Sample.RabbitMQ.SqlServer.Controllers
return Ok();
}

[CapSubscribe("sample.rabbitmq.mysql33333")]
[CapSubscribe("sample.rabbitmq.mysql33333",Group ="Test.Group")]
public void KafkaTest22(Person person)
{
var aa = _dbContext.Database;


+ 15
- 1
samples/Sample.RabbitMQ.SqlServer/Startup.cs View File

@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Sample.RabbitMQ.SqlServer.Services;
@@ -19,8 +20,21 @@ namespace Sample.RabbitMQ.SqlServer
services.AddCap(x =>
{
x.UseEntityFramework<AppDbContext>();
x.UseRabbitMQ("localhost");
x.UseRabbitMQ(z =>
{
z.HostName = "192.168.2.206";
z.UserName = "admin";
z.Password = "123123";
});
x.UseDashboard();
x.UseDiscovery(d =>
{
d.DiscoveryServerHostName = "localhost";
d.DiscoveryServerProt = 8500;
d.CurrentNodeHostName = "localhost";
d.CurrentNodePort = 5800;
d.NodeName = "CAP一号节点";
});
});

services.AddMvc();


Loading…
Cancel
Save