找到Nacos配置列表,选择开发环境learning-online-dev

创建订单管理工程配置:orders-api-dev.yaml

  • ID:orders-api-dev.yaml

  • Group:learning-online-project

  • 描述:订单微服务配置类

  • 配置内容:

    orders-api-dev.yaml
    server:
    port: 63030
    servlet:
    context-path: /orders

    spring:
    cloud:
    config:
    # 本地优先
    override-none: true

创建订单管理工程配置:orders-service-dev.yaml

  • ID:orders-service-dev.yaml

  • Group:learning-online-project

  • 配置内容:

    orders-service-dev.yaml
    spring:
    datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql:///lo_orders?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&allowPublicKeyRetrieval=true
    username: root
    password: swx852345

    mybatis-plus:
    mapper-locations: classpath*:mapper/*.xml
    type-aliases-package: com.swx.orders.model.po


    pay:
    qrcodeUrl: http://mb25gx.natappfree.cc/orders/requestpay?payNo=%s
    alipay:
    APP_ID: 9021000126649557
    APP_PRIVATE_KEY: # 沙盒环境应用私钥
    ALIPAY_PUBLIC_KEY: # 沙盒环境支付宝公钥
    NOTIFY_URL: http://mb25gx.natappfree.cc/orders/paynotify # 支付宝通知回调地址

创建消息队列配置:rabbitmq-dev.yaml

  • ID:rabbitmq-dev.yaml

  • Group:learning-online-common

  • 配置内容:

    rabbitmq-dev.yaml
    spring:
    rabbitmq:
    host: 124.221.23.47
    port: 5672
    username: swcode
    password: 123321
    virtual-host: /
    publisher-confirm-type: correlated #correlated 异步回调,定义ConfirmCallback,MQ返回结果时会回调这个ConfirmCallback
    publisher-returns: true #开启publish-return功能,同样是基于callback机制,需要定义ReturnCallback
    template:
    mandatory: true #定义消息路由失败时的策略。true,则调用ReturnCallback;false:则直接丢弃消息
    listener:
    simple:
    prefetch: 1 #每次只能获取一条消息,处理完成才能获取下一个消息
    acknowledge-mode: auto #auto:出现异常时返回unack,消息回滚到mq;没有异常,返回ack ,manual:手动控制,none:丢弃消息,不回滚到mq
    retry:
    enabled: false #开启消费者失败重试
    initial-interval: 5000ms #初识的失败等待时长为1秒
    multiplier: 1 #失败的等待时长倍数,下次等待时长 = multiplier * last-interval
    max-attempts: 3 #最大重试次数
    stateless: true #true无状态;false有状态。如果业务中包含事务,这里改为false