首页 文章

将Azure流分析的输出设置为Event Hub

提问于
浏览
0

我正在尝试使用事件中心作为Azure流分析的输出接收器,并且下面显示了执行此操作的代码 .

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
                        }
                    }
  }

我想要做的是将流分析的结果发送到事件中心的特定分区 . 我是通过将PartitionKey属性设置为我定义的字符串来完成的 . 但是,这不起作用 . 似乎EventHubOutputDataSourceProperties中的partitionKey属性不是事件中心中使用的分区键 . 然后我的问题是如何将其发送到特定分区并将分区键设置为我想要的 .

任何帮助表示赞赏 .

1 回答

  • 0

    PartitionKey属性需要查询输出中的列 . 要解决此问题,请在查询中添加一个代表所需分区的列 . 如果您的输入没有您想要的EH分区,您可以将其硬编码到查询中:

    SELECT '1' AS EHPartition, Column1, ... into output from input
    

    然后将PartitionKey属性设置为“EHPartition” .

相关问题