文章目录

1. Azure Function1.1 Azure Function 概念1.2 Azure Function 实现原理1.3 Azure Function 本地调试1.4 Azure Function 云部署

2. Azure API Managment 概念 以及使用2.1 Azure API 概念2.2 Azure API 基本使用

3. Service Bus 应用场景及相关特性3.1 Service Bus 基本简介与特性3.2 Service Bus 消息队列

4. Azure Monitor4.1 Azure Monitor 基本介绍4.2 Azure Monitor 观测性及查询

1. Azure Function

参考资料:Microsoft Azure 参考资料(快速入门):使用Visual studio在Azure中创建第一个c#函数 参考资料:AZ-900

1.1 Azure Function 概念

Azure Function:

1. 可以直接编写重要代码,不需要关心基础结构的维护,可以直接上传到云服务当中.

1.2 Azure Function 实现原理

1. 利用提供的触发器和绑定进行连接服务,例如绑定的Web API(HTTP触发器服务),当发生HTTP请求

时,Azure 云服务就可以对这个请求做出响应

代码分析: 效果图:  

1.3 Azure Function 本地调试

### 本地调试

1. 创建Azure Function项目(c#类),之后将其进行运行即可.

1.4 Azure Function 云部署

1. 本地测试代码通过

2. Azure本地资源当中创建函数应用

3. 将Azure Function本地代码上传到Azure当中对应的函数应用组当中

/api/HttpExample?name=Functions 追加至url地址之后

效果图:  

2. Azure API Managment 概念 以及使用

参考资料:Azure API管理文档

2.1 Azure API 概念

Azure API 管理是由API网关、管理平面以及开发人员组成的,API管理提供Azure当中组件的相关API管理的使用

2.2 Azure API 基本使用

通过Azure 创建第一个 Azure API实例在API管理当中创建测试API,并设置其返回Json{“word” : “beautiful”}启用响应式模拟,测试模拟API

效果图:

3. Service Bus 应用场景及相关特性

Azure Service Bus 服务

3.1 Service Bus 基本简介与特性

Service Bus简介 Service Bus 队列

Service Bus. 企业消息服务代理,其中有消息队列和发布订阅主题两种。Service Bus 队列类似于一个中间管理服务,将所有发送方的请求暂时以队列FIFO的方式暂存在中间通道,消息使用方按顺序从此中间站当中获取相应的服务.

3.2 Service Bus 消息队列

首先需要在Azure当中创建 Service Bus命名空间(可以为队列以及主题提供范围容器)在对应Service Bus 当中创建队列利用Visual Studio 测试队列消息的接受与发送

消息队列创建

消息队列代码

using Azure.Messaging.ServiceBus;

using Azure.Identity;

// service bus 队列,用于发送以及接收消息

ServiceBusClient client;

// the sender used to publish messages to the queue

ServiceBusSender sender;

// number of messages to be sent to the queue

const int numOfMessages = 3;

// The Service Bus client types are safe to cache and use as a singleton for the lifetime

// of the application, which is best practice when messages are being published or read

// regularly.

//

// Set the transport type to AmqpWebSockets so that the ServiceBusClient uses the port 443.

// If you use the default AmqpTcp, ensure that ports 5671 and 5672 are open.

var clientOptions = new ServiceBusClientOptions

{

TransportType = ServiceBusTransportType.AmqpWebSockets

};

// ServiceBus 的命名空间以及队列名称,以及默认的登录用户权限信息

client = new ServiceBusClient(

"ServiceBusExampleTestZhangyunyi.servicebus.windows.net", //

new DefaultAzureCredential(),

clientOptions);

sender = client.CreateSender("myqueue");

// create a batch

using ServiceBusMessageBatch messageBatch = await sender.CreateMessageBatchAsync();

for (int i = 1; i <= numOfMessages; i++)

{

// try adding a message to the batch

if (!messageBatch.TryAddMessage(new ServiceBusMessage($"Message {i}")))

{

// if it is too large for the batch

throw new Exception($"The message {i} is too large to fit in the batch.");

}

}

try

{

// Use the producer client to send the batch of messages to the Service Bus queue

await sender.SendMessagesAsync(messageBatch);

Console.WriteLine($"A batch of {numOfMessages} messages has been published to the queue.");

}

finally

{

// Calling DisposeAsync on client types is required to ensure that network

// resources and other unmanaged objects are properly cleaned up.

await sender.DisposeAsync();

await client.DisposeAsync();

}

Console.WriteLine("Press any key to end the application");

Console.ReadKey();

4. Azure Monitor

4.1 Azure Monitor 基本介绍

Azure Monitor 全面的数据监视解决,将数据收集到数据平台,数据平台存储监视数据。通过一些见解、可视化、和分析数据工具显示。

4.2 Azure Monitor 观测性及查询

Azure Monitor 是可观测性工具,通过进入相应对应的Azure资源当中,点击侧面的监视栏即可观测Azure Monitor 相关监视的一些可视化工具.

好文链接

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: