我有一个由事件中心触发的 Azure 函数。这是我的 index.js 文件的片段。
module.exports = async function (context, eventHubMessages) {
context.log(`JavaScript eventhub trigger function called for message array ${eventHubMessages}`);
context.log('Event Hub Trigger: ', JSON.stringify(eventHubMessages));
const product = context.bindingData.propertiesArray[0].productFilter;
eventHubMessages.forEach(message =>
{
deviceId = message.deviceId;
context.log('For each message:', JSON.stringify(eventHubMessages));
context.log('Device ID is', deviceId);
});
context.log('Output Device ID is', deviceId);
if ( product == 'prod1') {
context.bindings.outputprod1 = eventHubMessages;
} else if ( product == 'prod2') {
context.bindings.prod2 = eventHubMessages;
else {
context.log("Product not found - " + product);
} …Run Code Online (Sandbox Code Playgroud) 我有一个查找活动,可从Blob中的容器获取值。我有一个foreach活动,它与查找活动有关
在设置下,其值为:
@activity('LookupMessageType').output.value
Run Code Online (Sandbox Code Playgroud)
我还有另一个在该foreach活动中运行的复制活动。它将数据从cosmos DB复制到Azure Data Lake。

这是源数据集中的查询:
select c.Tag, data.assetTag, data.timestamp, data.jsonVersion, data.messageType, data.speed from c join data in c.data
where (data.speed> item().speed_Value) AND
(data.timestamp >= '@{formatDateTime(addhours(pipeline().TriggerTime, -1), 'yyyy-MM-ddTHH:mm:ssZ' )}'
AND data.timestamp < '@{formatDateTime(pipeline().TriggerTime, 'yyyy-MM-ddTHH:mm:ssZ' )}')
Run Code Online (Sandbox Code Playgroud)
运行此管道时出现错误:
{
"errorCode": "2200",
"message": "Failure happened on 'Source' side. ErrorCode=UserErrorDocumentDBReadError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=DocumentDb operation failed: Message: {\"errors\":[{\"severity\":\"Error\",\"location\":{\"start\":231,\"end\":235},\"code\":\"SC2005\",\"message\":\"'item' is not a recognized built-in function name.\"}]}\r\nActivityId: *redacted*, documentdb-dotnet-sdk/1.21.1 Host/64-bit MicrosoftWindowsNT/6.2.9200.0.,Source=Microsoft.DataTransfer.ClientLibrary.DocumentDb,''Type=Microsoft.Azure.Documents.BadRequestException,Message=Message: {\"errors\":[{\"severity\":\"Error\",\"location\":{\"start\":231,\"end\":235},\"code\":\"SC2005\",\"message\":\"'item' is not a recognized built-in function name.\"}]}\r\nActivityId: redacted, documentdb-dotnet-sdk/1.21.1 Host/64-bit MicrosoftWindowsNT/6.2.9200.0,Source=Microsoft.Azure.Documents.Client,''Type=System.Runtime.InteropServices.COMException,Message=Exception from HRESULT: 0x800A0B00,Source=,'",
"failureType": "UserError", …Run Code Online (Sandbox Code Playgroud) 我已经下载了最新的.NET Framework,我正在使用VS 2017 15.8.7上的.NET Core 2.0应用程序.这是我安装的软件包.
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
{
}
Run Code Online (Sandbox Code Playgroud)
我在这一行收到错误,说:
FileNotFoundException: Could not load file or assembly 'System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)
这是我的.csproj
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.PowerBI.Api" Version="2.0.14" />
<PackageReference Include="Microsoft.PowerBI.Core" Version="1.1.11" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.6" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
Run Code Online (Sandbox Code Playgroud)
为什么我收到此错误.我可以添加一个引用来使它工作吗?
[更新] 我在我的csproj中添加了以下行,我不再收到此错误.
<ItemGroup>
<Reference Include="System.Net.Http">
<HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\Framework\v4.0.30319\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest">
<HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\Framework\v4.0.30319\System.Net.Http.WebRequest.dll</HintPath>
</Reference>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud) asp.net system.net system.net.httpwebrequest asp.net-core-2.0
我有一个带有事件中心触发器的 Azure 函数。该中心接收来自设备的消息并将它们存储在 Blob 中。最近,我注意到重复的消息存储在 blob 中。Blob 存储中的文件按上次修改日期排序,如果您查看屏幕截图,您会发现情况并非如此。以前有人见过这个问题吗?
我还有一个正在写入 cosmos DB 的 Azure 函数,并且对于 blob 中的重复消息,cosmos 中没有相应的重复消息。
我还连接了时间序列见解,它也没有任何重复的消息。
我打开了事件中心捕获,那里也没有重复的消息。
这是屏幕截图。
第一列是事件中心排队时间的 unix 时间戳。如果我没有与文件名关联的 guid,它会抛出异常。这是将数据存储在 blob 中的片段。
dynamic msg = JObject.Parse(myEventHubMessage);
string deviceId = msg.deviceId;
if (deviceId == "5Y.....")
{
var filename = "_" + ((DateTimeOffset)enqueuedTimeUtc).ToUnixTimeSeconds() + "_" + Guid.NewGuid().ToString() + ".json";
var containerName = "containerName/";
var path = containerName + deviceId + "/" + filename;
using (var writer = binder.Bind<TextWriter>(new BlobAttribute(path)))
{
writer.Write(myEventHubMessage);
}
}
Run Code Online (Sandbox Code Playgroud)
这里的逻辑非常简单。如果事件到达事件中心,则会触发该函数并将数据存储在 Azure Blob 中。
我有一个从 API 获得的字节数组。
byte[] sticker = db.call_API_print_sticker(Id);
Run Code Online (Sandbox Code Playgroud)
我必须多次调用这个方法,然后转换为pdf。我想将它存储在一个数组数组中,然后在拥有所有数组后将它们转换
我如何存储它,然后将字节数组 pdf 合并为一个。
我正在使用 Azure 数据工厂将数据从 Azure Cosmos DB 复制到 Azure Data Lake。我的管道包含一个复制活动,它将数据复制到数据湖接收器。
这是我对源数据集的查询:
select * from c
where c.data.timestamp >= '@{formatDateTime(addminutes(pipeline().TriggerTime, -15), 'yyyy-MM-ddTHH:mm:ssZ' )}'
AND c.data.timestamp < '@{formatDateTime(pipeline().TriggerTime, 'yyyy-MM-ddTHH:mm:ssZ' )}'
Run Code Online (Sandbox Code Playgroud)
我正在获取触发时间前最后 15 分钟的数据。
现在,如果查询没有检索到数据,则复制活动会生成一个空文件并将其存储在数据湖中。我想阻止这种情况发生。我有什么办法可以实现这个目标吗?
这些是我拥有的类,它们代表了我希望向最终用户显示数据的方式:
namespace PHCTimeSeriesInsights.API.Models
{
public class ProductTimeSeries
{
public List<DeviceTimeSeries> DeviceTimeSeries { get; set; }
public string DeviceId { get; set; }
}
public class DeviceTimeSeries
{
public DateTime TimeStamp { get; set; }
public Double MeasuredValue { get; set; }
public string DateField { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
我想要以下格式的输出:这里的字符串 8787887 是设备的实际值;
{
"8787887":[
{
"prop":"val",
"prop":"val"
},
{
"prop":"val1",
"prop":"val2"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我有这个片段代表我所做的,但它没有给我一个最佳格式:
List<ProductTimeSeries> prd = new List<ProductTimeSeries>();
prd.Add(new ProductTimeSeries
{
DeviceId = getTelemetry.PropertyName,
DeviceTimeSeries = deviceIdTimeSeries …Run Code Online (Sandbox Code Playgroud) 我的属性设置如下:
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string TId { get; set; }
Run Code Online (Sandbox Code Playgroud)
我还希望能够确保这是驼峰式的。
[JsonProperty("tId")]
public string TId { get; set; }
Run Code Online (Sandbox Code Playgroud)
我怎样才能将这些合而为一?
asp.net ×3
azure ×3
c# ×3
arrays ×2
asp.net-core ×1
javascript ×1
json ×1
json.net ×1
pdf ×1
system.net ×1