Commit fc93d93b62f54364dd264b85ffe5ccfccbd26e1d

Authored by Andrew Shvayka
1 parent 633f8b0b

JSON type cast enhancements

@@ -406,6 +406,9 @@ transport: @@ -406,6 +406,9 @@ transport:
406 enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}" 406 enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}"
407 tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}" 407 tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}"
408 device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}" 408 device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}"
  409 + json:
  410 + # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
  411 + type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
409 # Local HTTP transport parameters 412 # Local HTTP transport parameters
410 http: 413 http:
411 enabled: "${HTTP_ENABLED:true}" 414 enabled: "${HTTP_ENABLED:true}"
@@ -443,7 +446,3 @@ transport: @@ -443,7 +446,3 @@ transport:
443 bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}" 446 bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}"
444 bind_port: "${COAP_BIND_PORT:5683}" 447 bind_port: "${COAP_BIND_PORT:5683}"
445 timeout: "${COAP_TIMEOUT:10000}" 448 timeout: "${COAP_TIMEOUT:10000}"
446 -  
447 -json:  
448 - # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON  
449 - type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:false}"  
@@ -23,7 +23,7 @@ import org.springframework.context.annotation.Configuration; @@ -23,7 +23,7 @@ import org.springframework.context.annotation.Configuration;
23 @Slf4j 23 @Slf4j
24 public class JsonConverterConfig { 24 public class JsonConverterConfig {
25 25
26 - @Value("${json.type_cast_enabled}") 26 + @Value("${transport.json.type_cast_enabled:true}")
27 public void setIsJsonTypeCastEnabled(boolean jsonTypeCastEnabled) { 27 public void setIsJsonTypeCastEnabled(boolean jsonTypeCastEnabled) {
28 JsonConverter.setTypeCastEnabled(jsonTypeCastEnabled); 28 JsonConverter.setTypeCastEnabled(jsonTypeCastEnabled);
29 log.info("JSON type cast enabled = {}", jsonTypeCastEnabled); 29 log.info("JSON type cast enabled = {}", jsonTypeCastEnabled);
@@ -30,6 +30,9 @@ transport: @@ -30,6 +30,9 @@ transport:
30 enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}" 30 enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}"
31 tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}" 31 tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}"
32 device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}" 32 device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}"
  33 + json:
  34 + # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
  35 + type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
33 36
34 kafka: 37 kafka:
35 enabled: true 38 enabled: true
@@ -52,7 +55,3 @@ kafka: @@ -52,7 +55,3 @@ kafka:
52 topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}" 55 topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}"
53 poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}" 56 poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}"
54 auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}" 57 auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}"
55 -  
56 -json:  
57 - # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON  
58 - type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"  
@@ -31,6 +31,9 @@ transport: @@ -31,6 +31,9 @@ transport:
31 enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}" 31 enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}"
32 tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}" 32 tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}"
33 device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}" 33 device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}"
  34 + json:
  35 + # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
  36 + type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
34 37
35 kafka: 38 kafka:
36 enabled: true 39 enabled: true
@@ -53,7 +56,3 @@ kafka: @@ -53,7 +56,3 @@ kafka:
53 topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}" 56 topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}"
54 poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}" 57 poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}"
55 auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}" 58 auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}"
56 -  
57 -json:  
58 - # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON  
59 - type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"  
@@ -50,6 +50,9 @@ transport: @@ -50,6 +50,9 @@ transport:
50 enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}" 50 enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}"
51 tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}" 51 tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}"
52 device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}" 52 device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}"
  53 + json:
  54 + # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
  55 + type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
53 56
54 kafka: 57 kafka:
55 enabled: true 58 enabled: true
@@ -72,7 +75,3 @@ kafka: @@ -72,7 +75,3 @@ kafka:
72 topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}" 75 topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}"
73 poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}" 76 poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}"
74 auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}" 77 auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}"
75 -  
76 -json:  
77 - # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON  
78 - type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"