-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
154 additions
and
8 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
samples/docker-compose/infrastr/docker-compose.rabbitmq.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: "3.7" | ||
|
||
services: | ||
lms.rabbitmq: | ||
image: rabbitmq:management | ||
restart: always | ||
environment: | ||
RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG" | ||
RABBITMQ_DEFAULT_USER: "rabbitmq" | ||
RABBITMQ_DEFAULT_PASS: "rabbitmq" | ||
RABBITMQ_DEFAULT_VHOST: "/" | ||
ports: | ||
- "15672:15672" | ||
- "5672:5672" | ||
networks: | ||
- lms_service_net | ||
|
||
networks: | ||
lms_service_net: | ||
external: | ||
name: lms_service_net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
samples/microservices/account/Lms.AccountHost/CapConfigure.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Lms.Account.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Silky.Lms.Core; | ||
|
||
namespace Lms.AccountHost | ||
{ | ||
public class CapConfigure : IConfigureService | ||
{ | ||
public void ConfigureServices(IServiceCollection services, IConfiguration configuration) | ||
{ | ||
services.AddCap(x => | ||
{ | ||
x.UseEntityFramework<UserDbContext>(); | ||
x.UseRabbitMQ(z => | ||
{ | ||
z.HostName = "127.0.0.1"; | ||
z.UserName = "rabbitmq"; | ||
z.Password = "rabbitmq"; | ||
}); | ||
}); | ||
} | ||
|
||
public int Order { get; } = 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
samples/microservices/order/Lms.Order.Application/Subscribe/ISubscriberService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace Lms.Order.Application.Subscribe | ||
{ | ||
public interface ISubscriberService | ||
{ | ||
void CheckReceivedMessage(DateTime datetime); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
samples/microservices/order/Lms.Order.Application/Subscribe/SubscriberService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using DotNetCore.CAP; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Lms.Order.Application.Subscribe | ||
{ | ||
public class SubscriberService : ICapSubscribe, ISubscriberService | ||
{ | ||
private readonly ILogger<SubscriberService> _logger; | ||
|
||
public SubscriberService(ILogger<SubscriberService> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
[CapSubscribe("account.create.time")] | ||
public void CheckReceivedMessage(DateTime datetime) | ||
{ | ||
_logger.LogInformation("Create Account Time:" + datetime.ToLocalTime()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Lms.Order.Application.Subscribe; | ||
using Lms.Order.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Silky.Lms.Core; | ||
|
||
namespace Lms.OrderHost | ||
{ | ||
public class CapConfigure : IConfigureService | ||
{ | ||
public void ConfigureServices(IServiceCollection services, IConfiguration configuration) | ||
{ | ||
services.AddTransient<ISubscriberService,SubscriberService>(); | ||
services.AddCap(x => | ||
{ | ||
x.UseEntityFramework<OrderDbContext>(); | ||
x.UseRabbitMQ(z => | ||
{ | ||
z.HostName = "127.0.0.1"; | ||
z.UserName = "rabbitmq"; | ||
z.Password = "rabbitmq"; | ||
}); | ||
}); | ||
} | ||
|
||
public int Order { get; } = 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Lms.Stock.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Silky.Lms.Core; | ||
|
||
namespace Lms.StockHost | ||
{ | ||
public class CapConfigure : IConfigureService | ||
{ | ||
public void ConfigureServices(IServiceCollection services, IConfiguration configuration) | ||
{ | ||
services.AddCap(x => | ||
{ | ||
x.UseEntityFramework<StockDbContext>(); | ||
x.UseRabbitMQ(z => | ||
{ | ||
z.HostName = "127.0.0.1"; | ||
z.UserName = "rabbitmq"; | ||
z.Password = "rabbitmq"; | ||
}); | ||
}); | ||
} | ||
|
||
public int Order { get; } = 10; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters