我知道错误信息是不言自明的,我们无法多次读取邮件正文。在这里,我正在使用AOP(面向方面编程)进行审计日志。
[AuditServiceMethod(AttributePriority = 0)]
[FunctionName("ValidateSubscriber")]
public static async Task RunAsync([ServiceBusTrigger("validate-message", AccessRights.Manage,
Connection = "ServiceBusConnection")]BrokeredMessage message,
TraceWriter log,
[Inject(typeof(ICommonUtilities))] ICommonUtilities commonUtility)
{
string body;
using (var stream = message.GetBody<Stream>())
using (var streamReader = new StreamReader(stream, Encoding.UTF8))
{
body = await streamReader.ReadToEndAsync();
}
}
[AuditServiceMethod] 是我审核请求,响应和错误日志的方面。 有没有什么好的解决方法可以在Azure函数中多次获取body?