I have a scenario where a Device sends data in this format
[
{
"Metadata":{"DeviceID":"MWS55V","GatewayID":"abc1"},
"Payload": [{"Type":"401","Data":"17.51"}],
"Timestamp":"2018-11-01T09:33:05Z"},
{
"Metadata":{"DeviceID":"MWS55V","GatewayID":"abc1"},
"Payload": [{"Type":"401","Data":"18.28"}],
"Timestamp":"2018-11-01T09:34:05Z"
}
]
I added Azure Stream Analytics C# UDF
with the idea to use the whole object as a parameter and change each Payload.Data
based on the Payload.Type
.
But when I try to pass Payload
object as a parameter to the c# UDF
an exception is thrown
Error : ** System Exception ** ASA passed a non-supported type System.Object to be marshaled to CSharp UDF Func at variable payload
The only way it worked is if when I tried parameters of type(long, string etc).
Although this doc explicitly saying the supported types, is there a way to receive the whole object inside c# udf
or this service is not the best for this scenario and I need to use something else ?
The Payload object is an array, which is a supported type in Stream Analytics C# UDFs. Your function signature should look like:
public static string SampleUDF(Object[] input)
You should not see an error with this. Let me know if you still run into issues.