我正在尝试将WebJob集成到ADF管道中。webjob是一个非常简单的控制台应用程序:
namespace WebJob4
{
class ReturnTest
{
static double CalculateArea(int r)
{
double area = r * r * Math.PI;
return area;
}
static void Main()
{
int radius = 5;
double result = CalculateArea(radius);
Console.WriteLine("The area is {0:0.00}", result);
}
}
}
我们如何通过ADF管道调用此Web作业,并将响应代码(如果成功,则为HTTP 200)存储在azure blob存储中?
2018年12月更新:
如果你想使用azure函数来实现这一点,azure数据工厂NOW为你提供了azure函数步骤!基本原理与您必须使用HTTP触发器公开azure函数相同。但是,这提供了更好的安全性,因为您可以使用ACL 指定数据工厂实例访问azure函数
参考:https://azure.microsoft.com/en-us/blog/azure-functions-now-supported-as-a-step-in-azure-data-factory-pipelines/
原始答案
- 从发布的评论来看,我相信你不想使用自定义活动路线
- 您可以尝试为此使用复制任务,即使这可能不是预期目的
- 存在可用于从网络源复制数据的CCD_ 1
https://learn.microsoft.com/en-us/azure/data-factory/v1/data-factory-http-connector
- 复制任务触发http端点
- 可以指定各种身份验证机制,从基本到OAuth2
- 下面我使用端点来触发azure函数进程,输出保存在datalake文件夹中用于日志记录(很明显,你可以使用其他东西,比如在你的情况下,它是blob存储。)
基本链接服务
{
"name": "linkedservice-httpEndpoint",
"properties": {
"type": "Http",
"typeProperties": {
"url": "https://azurefunction.api.com/",
"authenticationType": "Anonymous"
}
}
}
基本输入数据集
{
"name": "Http-Request",
"properties": {
"type": "Http",
"linkedServiceName": "linkedservice-httpEndpoint",
"availability": {
"frequency": "Minute",
"interval": 30
},
"typeProperties": {
"relativeUrl": "/api/status",
"requestMethod": "Get",
"format": {
"type": "TextFormat",
"columnDelimiter": ","
}
},
"structure": [
{
"name": "Status",
"type": "String"
}
],
"published": false,
"external": true,
"policy": {}
}
}
输出
{
"name": "Http-Response",
"properties": {
"structure": [
...
],
"published": false,
"type": "AzureDataLakeStore",
"linkedServiceName": "linkedservice-dataLake",
"typeProperties": {
...
},
"availability": {
...
},
"external": false,
"policy": {}
}
}
活动
{
"type": "Copy",
"name": "Trigger Azure Function or WebJob with Http Trigger",
"scheduler": {
"frequency": "Day",
"interval": 1
},
"typeProperties": {
"source": {
"type": "HttpSource",
"recursive": false
},
"sink": {
"type": "AzureDataLakeStoreSink",
"copyBehavior": "MergeFiles",
"writeBatchSize": 0,
"writeBatchTimeout": "00:00:00"
}
},
"inputs": [
{
"name": "Http-Request"
}
],
"outputs": [
{
"name": "Http-Response"
}
],
"policy": {
...
}
}