我尝试读取CSV文件并逐行将数据发送到Azure Table Storage。我使用时间戳为每条消息添加一个变量,使数据唯一。但是,如果我在两条消息中发送两行数据。只有第二条消息出现,第一条消息引发错误:
这是消息一:
{
"tableName":"name",
"action":"I",
"partitionKey":"part2",
"rowKey":"1476649418331",
"data":{"Column1":"Row1C1","Column2":"Row1C2","Column3":"Row1C3"}
}
返回:
16-10-2016 22:23:39Azure Table Storage
msg : string [163]
Error while trying to save data:StorageError: The specified entity already exists. RequestId:cedf2110-0002-007f-4eeb-275e5e000000 Time:2016-10-16T20:23:40.3597774Z
这是第二条消息:
{
"tableName":"name",
"action":"I",
"partitionKey":"part2",
"rowKey":"1476649418332",
"data":{"Column1":"Row2C1","Column2":"Row2C2","Column3":"Row2C3"}
}
返回:
16-10-2016 22:23:39Log
msg : string [11]
data saved.
这是我的节点红色流程:
[
{"id":"9a96640e.8ac6a8","type":"tab","label":"Flow 1"},
{"id":"79f08138.3591e","type":"debug","z":"9a96640e.8ac6a8","name":"","active":true,"console":"false","complete":"payload","x":724.5,"y":119,"wires":[]},
{"id":"6ba900e3.b8c68","type":"function","z":"9a96640e.8ac6a8","name":"dynamic","func":"msg.topic = msg.payload; \nreturn msg;","outputs":1,"noerr":0,"x":163.5,"y":192,"wires":[["e9ba66a6.2609f8"]]},
{"id":"881bed10.69e5","type":"function","z":"9a96640e.8ac6a8","name":"merge","func":"if (!context.value) {\n context.value = 0;\n}\ncontext.value +=1;\n\n\n\nvar RowKey = String(msg.topic + context.value);\nvar Data = msg.payload;\n\nmsg.payload = {\"tableName\": \"name\", \"action\": \"I\", \"partitionKey\": \"part2\", \"rowKey\": RowKey, \"data\": Data};\n/*msg.payload = {\"tableName\": \"name\", \"action\": \"I\", \"partitionKey\": \"part2\", \"rowKey\": \"row13\", \"data\": {\"Column\": \"Value13\"}};*/\nreturn msg;","outputs":1,"noerr":0,"x":404,"y":166,"wires":[["180d09fa.2000c6"]]},
{"id":"180d09fa.2000c6","type":"json","z":"9a96640e.8ac6a8","name":"","x":543,"y":210,"wires":[["79f08138.3591e","8b1be5eb.5dcbc8"]]},
{"id":"8b1be5eb.5dcbc8","type":"Table Storage","z":"9a96640e.8ac6a8","name":"Azure Table Storage","x":766.5,"y":209,"wires":[["fe41d516.3e8208"]]},
{"id":"fe41d516.3e8208","type":"debug","z":"9a96640e.8ac6a8","name":"Log","active":true,"console":"false","complete":"true","x":794.5,"y":403,"wires":[]},
{"id":"7deb1c15.482474","type":"inject","z":"9a96640e.8ac6a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":76,"y":306,"wires":[["6ba900e3.b8c68"]]},
{"id":"17a020b6.e0f95f","type":"csv","z":"9a96640e.8ac6a8","name":"CSV parser","sep":"\\t","hdrin":true,"hdrout":true,"multi":"one","ret":"\\n","temp":"A,B,C,D","x":464,"y":305,"wires":[["1dc33972.1e6177","881bed10.69e5"]]},
{"id":"e9ba66a6.2609f8","type":"file in","z":"9a96640e.8ac6a8","name":"File Reader","filename":"D:\\TESTCSV.txt","format":"utf8","x":264,"y":305,"wires":[["17a020b6.e0f95f"]]},
{"id":"1dc33972.1e6177","type":"debug","z":"9a96640e.8ac6a8","name":"","active":false,"console":"false","complete":"false","x":443,"y":405,"wires":[]}
]
有人知道这个错误来自哪里吗?