Reputation: 5556
I have the following payload (JSON) in my MQTT broker AWS IoT-Core / Topic (+/+/myTopic
):
{
"id":"sig3678",
"r_timestmp":1659443813,
"sku":61,
"z_x_1":{
"a_b":[ 234, 245, ...],
"c_d":[ 435, -45, ...]
},
"z_x_2":{
"a_b":[ -123, 245, ...],
"c_d":[ 678, 245, ...]
},
"ad_xz3":657
}
I have a rule that save this payload to a Timestream
table:
SELECT id AS id, r_timestamp AS r_timestamp,cast(get("z_x_1","a_b") as string) AS z_x_1_a_b FROM '+/+/myTopic'
As per the documentation I can't use z_x_1.a_b
to get the object [ 234, 245, ...]
. Also I want to save a string from this object then I need to convert this object into a string using cast()
function from this documentation.
Inside the rule I have the following: Dimensions: name: z_x_1_a_b, value ${z_x_1_a_b}
And in CloudWatch I am getting the followin error:
"failures": [
{
"failedAction": "TimestreamAction",
"failedResource": "sig3678#z_x_1_a_b",
"errorMessage": "Failed to write records to Timestream. The error received was 'Errors at dimensions.1: [Dimension value can not be empty.], Errors at measures.2: [Measure value is empty.]'. Message arrived on +/+/myTopic, Action: timestream, Database: sig3678, Table: z_x_1_a_b"
}
]
The desired output should be:
{
id:'sig3678',
r_timestamp:1659443813,
z_x_1_a_b: '[ 234, 245, ...]'
}
ready to be inserted in the table z_x_1_a_b
. It seems that z_x_1_a_b
is comming empty [Dimension value can not be empty.]
. Maybe some issue with the way I am filtering the topic?!
What am I missing?
Upvotes: 2
Views: 959