I am trying to use the event hub as the output sink for the Azure stream analytics and the code to do it is shown below.
OutputCreateOrUpdateParameters jobOutputCreateParameters = new OutputCreateOrUpdateParameters()
{
Output = new Output()
{
Name = streamAnalyticsOutputName,
Properties = new OutputProperties()
{
Serialization = new JsonSerialization
{
Properties = new JsonSerializationProperties
{
Encoding = "UTF8"
}
},
DataSource = new EventHubOutputDataSource
{
Properties = new EventHubOutputDataSourceProperties
{
ServiceBusNamespace = "UKFC2-ns",
SharedAccessPolicyName = "manage",
SharedAccessPolicyKey = "aWFOgfkXPCYz5fdLMIIPXGEkT0EszW+g/OEOI3jhx5U=",
EventHubName = "ukfc1",
PartitionKey = partition
}
}
}
What I want to do is to send the result of the stream analytics to a specific partition in the event hub. I did it by setting the PartitionKey property to a string I defined. However, that doesn't work. It seems that the partitionKey property in the EventHubOutputDataSourceProperties is not the partition key used in the event hub. Then my question is how can I send the to a specific partition and set the partition key to what I want.
Any help is appreciated.
答案 0 :(得分:0)
PartitionKey属性需要查询输出中的列。要解决此问题,请在查询中添加一个代表所需分区的列。如果您的输入没有您想要的EH分区,您可以将其硬编码到查询中:
SELECT '1' AS EHPartition, Column1, ... into output from input
然后将PartitionKey属性设置为" EHPartition"。