【发布时间】:2019-05-13 08:11:34
【问题描述】:
我已经设置了一个 WebJob,它每分钟向 NotificationHub 发送一个通知以进行测试,我需要它来发送多个通知,而不仅仅是一个。
我尝试只发送一组 Notification 对象而不是一个对象,但这似乎不起作用。
函数.cs
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
public static void SendNotif1([TimerTrigger("0 * * * * *")] TimerInfo time, TextWriter log, [NotificationHub] out Notification notification)
{
string title = "Hello";
string message = "Message";
notification = new GcmNotification(ToGcmPayload(title, message));
}
private static string ToGcmPayload(string title, string message)
{
var gcmPayloadModel = new
{
data = new
{
FormType = "Next scheduler",
MemberForm = "Hello"
}
};
return JsonConvert.SerializeObject(gcmPayloadModel);
}
}
我是否试图以错误的方式做到这一点?
【问题讨论】:
标签: c# azure azure-webjobs azure-webjobssdk