Menu
🌜
🌞
- 1. 框架介绍
- 2. 注册中心
- 3. 服务Provider
- 4. 网关&监控
- 5. 服务资源监控
- 6. 集群接口文档
- 7. Hello World
- 8. 集成Java
- 9. 进阶指南
- 10. 领域驱动设计
- 11. 事件总线
- 12. 更多
- 13.1 好文章集合

Package name | Description | Version | Downloads |
---|---|---|---|
Anno.Const | 配置库 | ||
Anno.Log | 日志库 | ||
Anno.Loader | 依赖注入库 | ||
Anno.CronNET | 任务调度库 | ||
Anno.EngineData | 业务处理基础库 |
Anno.Plugs.HelloWorldService
初始化配置
实现接口: IPlugsConfigurationBootstrap
using Anno.EngineData;
using System;
namespace Anno.Plugs.HelloWorldService
{
/// <summary>
/// 插件启动引导器
/// DependsOn 依赖的类型程序集自动注入DI容器
/// </summary>
[DependsOn(
//typeof(Domain.Bootstrap)
//, typeof(QueryServices.Bootstrap)
//, typeof(Repository.Bootstrap)
//, typeof(Command.Handler.Bootstrap
)]
public class HelloWorldBootStrap : IPlugsConfigurationBootstrap
{
/// <summary>
/// Service 依赖注入构建之后调用
/// </summary>
public void ConfigurationBootstrap()
{
//throw new NotImplementedException();
}
/// <summary>
/// Service 依赖注入构建之前调用
/// </summary>
/// </summary>
public void PreConfigurationBootstrap()
{
//throw new NotImplementedException();
}
}
}
功能模块实现 继承: BaseModule
/**
Writer:Du YanMing
Mail:dym880@163.com
Create Date:2020/10/30 13:15:24
Functional description: HelloWorldViperModule
**/
using System;
using System.Collections.Generic;
using System.Text;
namespace Anno.Plugs.HelloWorldService
{
using Anno.Const.Attribute;
using Anno.EngineData;
using HelloWorldDto;
using System.ComponentModel.DataAnnotations;
public class HelloWorldViperModule : BaseModule
{
[AnnoInfo(Desc = "世界你好啊SayHi")]
public dynamic SayHello([AnnoInfo(Desc = "称呼")] string name, [AnnoInfo(Desc = "年龄")] int age)
{
Dictionary<string, string> input = new Dictionary<string, string>();
input.Add("vname", name);
input.Add("vage", age.ToString());
var soEasyMsg = Newtonsoft.Json.JsonConvert.DeserializeObject<ActionResult<string>>(
this.InvokeProcessor("Anno.Plugs.SoEasy", "AnnoSoEasy", "SayHi", input)).OutputData;
return new { HelloWorldViperMsg = $"{name}你好啊,今年{age}岁了", SoEasyMsg = soEasyMsg };
}
[AnnoInfo(Desc = "两个整数相减等于几?我来帮你算(x-y=?)")]
public int Subtraction([AnnoInfo(Desc = "整数X")] int x, [AnnoInfo(Desc = "整数Y")] int y)
{
return x - y;
}
[AnnoInfo(Desc = "买个商品吧,双十一马上就来了")]
public ProductDto BuyProduct([AnnoInfo(Desc = "商品名称")] string productName
, [AnnoInfo(Desc = "商品数量")] int number)
{
double price = new Random().Next(2, 90);
Dictionary<string, string> input = new Dictionary<string, string>();
input.Add("productName", productName);
input.Add("number", number.ToString());
var product = Newtonsoft.Json.JsonConvert
.DeserializeObject<ActionResult<ProductDto>>(this.InvokeProcessor("Anno.Plugs.SoEasy"
, "AnnoSoEasy", "BuyProduct", input)).OutputData;
product.CountryOfOrigin = $"中国北京中转—{ product.CountryOfOrigin}";
return product;
}
}
}
配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!—0,0 第一位是 工作站,第二位数据中心
(所有的 AnnoService 的 两位数不能重复例如不能存在【1,2】【1,2】)
可以存在【1,2】【2,1】
—>
<IdWorker>0,0</IdWorker>
<!—App名称—>
<AppName>App001</AppName>
<!—监听端口—>
<Port>6659</Port>
<!—权重—>
<Weight>1</Weight>
<!—功能(服务启动的时候会自动扫描Anno.Plugs.xxService格式的插件,
如果命名不是按照这个规范,需要在这里手动配置)—>
<FuncName>Anno.Plugs.LogicService,Anno.Plugs.TraceService</FuncName>
<!—忽略的功能 Trace,Logic—>
<IgnoreFuncName></IgnoreFuncName>
<!—超时时间毫秒—>
<TimeOut>20000</TimeOut>
<!—注册到的目标—>
<Ts Ip="10.112.93.122" Port="6660"/>
<IocDll>
<!— IOC 仓储、领域 推荐使用 [DependsOn]—>
<!— <Assembly>Anno.Repository</Assembly>—>
</IocDll>
<appSettings>
</appSettings>
</configuration>
### 网关#
参考Viper
Edit this page
Next
1.2 Viper 面板简介 »
- Anno 特色
- 基础组件包
- 通信组件包
- 扩展组件包
- 整体架构
- 主要功能
- 注册中心(AnnoCenter)
- 服务(AnnoService)
- 网关
文档
社区
更多
Copyright © 2022 Anno.