Reputation: 932
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.
Upvotes: 0
Views: 680
Reputation: 91
The PartitionKey property is expecting a column from your query output. To solve this, add a column in your query that represents the partition you want. If your input doesn't have the EH partition you want, you could hard code it into the query:
SELECT '1' AS EHPartition, Column1, ... into output from input
Then set the PartitionKey property to "EHPartition".
Upvotes: 0