Azure WebJobs Table 触发器
Azure WebJobs Table Trigger
像往常一样,应该简单的东西永远不会。有 50 亿个绑定到 BLOB 和队列的示例,但我找不到任何适用于绑定到表的示例。我有一个名为 Foo 的 table,我通过 Azure 存储资源管理器将数据添加到(PK 和 RK),而 webjob 是 运行 并且触发器永远不会被击中。这是 Functions.cs 中的方法,它在 webjob 启动时被识别:
public static void ReadTable([Table("Foo")] ICollector<TableEntity> tableBinding, TextWriter logger)
这个签名是一个猜测,因为有无穷无尽的关于旧签名等的博客。我已经尝试了 3 个小时,更改了任何编译但发现适用于 WebJob 和 Tables 的零文档。
Main() 是:
static void Main()
{
var host = new JobHost();
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
}
已为 AzureWebJobsDashboard 和 AzureWebJobsStorage 正确设置了 2 个配置条目。
另外:
<package id="Microsoft.Azure.WebJobs" version="1.0.1" targetFramework="net45" />
<package id="Microsoft.Azure.WebJobs.Core" version="1.0.1" targetFramework="net45" />
为什么这不起作用?????
您实际上并没有在代码中添加 "Trigger"。
这不是你的错,因为目前 Microsoft.Azure.WebJobs 命名空间中只有:QueueTrigger 和 BlobTrigger。没有 TableTrigger。
.....
但是(总有一个但是),根据 Mike Stall
"Functions are not triggered on table changes. However, once a function is called for some other reason, it can bind to a table as a read/write resource for doing its task. "
public static void TableDict([Table("mytable")] IDictionary<Tuple<string, string>, OtherStuff> dict)
{
...
}
我能看到 'monitor and fire and event on a new row on an Azure Table' 的唯一方法是将任何内容写入 table,改为编写一个新的队列消息,然后它可以触发所有逻辑并执行插入(?)...
像往常一样,应该简单的东西永远不会。有 50 亿个绑定到 BLOB 和队列的示例,但我找不到任何适用于绑定到表的示例。我有一个名为 Foo 的 table,我通过 Azure 存储资源管理器将数据添加到(PK 和 RK),而 webjob 是 运行 并且触发器永远不会被击中。这是 Functions.cs 中的方法,它在 webjob 启动时被识别:
public static void ReadTable([Table("Foo")] ICollector<TableEntity> tableBinding, TextWriter logger)
这个签名是一个猜测,因为有无穷无尽的关于旧签名等的博客。我已经尝试了 3 个小时,更改了任何编译但发现适用于 WebJob 和 Tables 的零文档。
Main() 是:
static void Main()
{
var host = new JobHost();
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
}
已为 AzureWebJobsDashboard 和 AzureWebJobsStorage 正确设置了 2 个配置条目。
另外:
<package id="Microsoft.Azure.WebJobs" version="1.0.1" targetFramework="net45" />
<package id="Microsoft.Azure.WebJobs.Core" version="1.0.1" targetFramework="net45" />
为什么这不起作用?????
您实际上并没有在代码中添加 "Trigger"。
这不是你的错,因为目前 Microsoft.Azure.WebJobs 命名空间中只有:QueueTrigger 和 BlobTrigger。没有 TableTrigger。
.....
但是(总有一个但是),根据 Mike Stall "Functions are not triggered on table changes. However, once a function is called for some other reason, it can bind to a table as a read/write resource for doing its task. "
public static void TableDict([Table("mytable")] IDictionary<Tuple<string, string>, OtherStuff> dict)
{
...
}
我能看到 'monitor and fire and event on a new row on an Azure Table' 的唯一方法是将任何内容写入 table,改为编写一个新的队列消息,然后它可以触发所有逻辑并执行插入(?)...