(八)复习(拆分微服务)


文章目录

  • 项目地址
  • 一、Ticketing模块拆分
    • [1.1 创建web api](#1.1 创建web api)
      • [1. 添加引用](#1. 添加引用)
      • [2. 添加需要的包和配置](#2. 添加需要的包和配置)
      • [3. program.cs](#3. program.cs)
      • [4. docker-compose修改](#4. docker-compose修改)

项目地址

  • 教程作者:
  • 教程地址:
复制代码
  • 代码仓库地址:
复制代码
  • 所用到的框架和插件:

    dbt
    airflow

一、Ticketing模块拆分

1.1 创建web api

1. 添加引用

复制代码
  <ItemGroup>
    <ProjectReference Include="..\..\Modules\Ticketing\Evently.Modules.Ticketing.Infrastructure\Evently.Modules.Ticketing.Infrastructure.csproj" />
  </ItemGroup>
  • 删除program.cs里没有用的服务

2. 添加需要的包和配置

  • Ticketing的webapi和Event.api一样,直接复制粘贴

  • 将Event.api里的appsettings复制到改web api只留下自己相关的 appsettings.development.json

    {
    "ConnectionStrings": {
    "Database": "Host=evently.database;Port=5432;Database=evently;Username=postgres;Password=postgres;Include Error Detail=true",
    "Cache": "evently.redis:6379",
    "Queue": "amqp://evently-queue:5672"
    },
    "Authentication": {
    "Audience": "account",
    "TokenValidationParameters": {
    "ValidIssuers": [ "http://evently.identity:8080/realms/evently", "http://localhost:18080/realms/evently" ]
    },
    "MetadataAddress": "http://evently.identity:8080/realms/evently/.well-known/openid-configuration",
    "RequireHttpsMetadata": false
    },
    "KeyCloak": {
    "HealthUrl": "http://evently.identity:8080/health/"
    },
    "Serilog": {
    "Using": [
    "Serilog.Sinks.Console",
    "Serilog.Sinks.Seq"
    ],
    "MinimumLevel": {
    "Default": "Information",
    "Override": {
    "Microsoft": "Information",
    "Evently.Modules.Ticketing.Infrastructure.Outbox": "Warning",
    "Evently.Modules.Ticketing.Infrastructure.Inbox": "Warning"
    }
    },
    "WriteTo": [
    { "Name": "Console" },
    {
    "Name": "Seq",
    "Args": { "serverUrl": "http://evently.seq:5341" }
    }
    ],
    "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
    "Properties": {
    "Application": "Evently.Ticketing.Api"
    }
    },
    "OTEL_EXPORTER_OTLP_ENDPOINT": "http://evently.jaeger:4317"
    }

3. program.cs

  • 删除所有需要其他模块的配置

4. docker-compose修改

相关推荐
初次攀爬者4 天前
ZooKeeper 实现分布式锁的两种方式
分布式·后端·zookeeper
科技前瞻观察5 天前
腾讯控股下的销售易,如何重塑中国CRM格局?
microsoft
电商API&Tina5 天前
京东商品详情API接口接入与应用
数据库·microsoft
断手当码农5 天前
Redis 实现分布式锁的三种方式
数据库·redis·分布式
yuan199975 天前
基于C#实现的专业级DXF文件显示控件
windows·microsoft·c#
初次攀爬者5 天前
Redis分布式锁实现的三种方式-基于setnx,lua脚本和Redisson
redis·分布式·后端
业精于勤_荒于稀5 天前
物流订单系统99.99%可用性全链路容灾体系落地操作手册
分布式
Asher05095 天前
Hadoop核心技术与实战指南
大数据·hadoop·分布式
凉凉的知识库5 天前
Go中的零值与空值,你搞懂了么?
分布式·面试·go