The original doc lists the necessary steps:
- Install the latest .NET SDK
- Create a new dotnet class library with
dotnet new classlib -o myCustomDeserializer
- In that project, install the ASA package with
dotnet add package Microsoft.Azure.StreamAnalytics
- If the deserializer somehow needs to deal with JSON files, also
dotnet add package Newtonsoft.JSON
Important note not (yet) in the doc: the project needs to be built on dotnet standard, not dotnet core (current default when using the dotnet CLI).
It is important to update the .csproj
with the following TargetFramework:
...
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>latest</LangVersion>
...
</PropertyGroup>
...
LangVersion is set to latest
to be able to use the newest version of C#.
Use dotnet restore
in the project folder if need be.
The ASA job needs to have a global storage account and a custom code storage account. They don't need to be the same.
For local ASA projects these settings are found in the JobConfig.json
Set up the Format to CustomClr
(Custom
in the picker) in the config file, then set the SerializationProjectPath
, build and select the SerializationClassName
.
{
"InputAlias": "Input1",
"Type": "Data Stream",
"Format": "CustomClr",
"SerializationProjectPath": "..\\myJsonDeserializer\\myJsonDeserializer.csproj",
"SerializationClassName": "myJsonDeserializer.myJsonDeserializer",
"SerializationDllPath": "myJsonDeserializer.dll",
"FilePath": "data_input1.json",
"ScriptType": "InputMock"
}
From there on, local runs with local inputs will use the custom deserializer.
Similarly, set Serialization to CustomClr
(Custom
in the picker), then set the SerializationProjectPath
, build and select the SerializationClassName
.
{
...
"Serialization": {
"Type": "CustomClr",
"SerializationProjectPath": "..\\myJsonDeserializer\\myJsonDeserializer.csproj",
"SerializationClassName": "myJsonDeserializer.myJsonDeserializer",
"SerializationDllPath": "myJsonDeserializer.dll"
},
...
}
From there on, local runs on live inputs will use the custom deserializer.