【发布时间】:2020-02-01 18:36:15
【问题描述】:
我正在从用节点 js 编写的 Web 作业向事件中心发送批处理数据,并且我可以在 Azure 流分析中接收数据。 但我无法在 ASA 上看到分区键。 我正在使用以下代码将数据发送到事件中心。
const {EventHubClient} = require("@azure/event-hubs");
var axios = require('axios');
const connectionString = "Endpoint=connectionstring";
const eventHubsName = "eventhubname";
async function main(){
const client = EventHubClient.createFromConnectionString(connectionString,eventHubsName);
var axios = require('axios');
var response = await axios.get('https://nseindia.com/live_market/dynaContent/live_watch/stock_watch/nifty500StockWatch.json');
var response1 = await axios.get('https://www.nseindia.com/live_market/dynaContent/live_analysis/gainers/niftyGainers1.json');
var eventData = [{body:response1['data']['data'],partitionKey:"pk12346"},{body:response['data']['data'],partitionKey:"pk12345"}];
console.log(eventData);
console.log("begin send...");
await client.sendBatch(eventData);
await client.close();
}
main().catch(err =>{
console.log("Error occurred: ",err);
});
response1['data']['data'] 和 response1['data']['data'] 中的数据是一个对象数据数组。 例如 [{key1:value1,key2:value2},{{key1:value1,key2:value2}}]
如果我无法在 ASA 上看到分区(从输入获取样本数据时)如何使用 where 条件作为分区键并应用 trnsformation。
【问题讨论】:
标签: node.js azure-webjobs azure-eventhub azure-stream-analytics