Skip to content

Commit

Permalink
Merge pull request #39 from SoftwareAG/feature-new-samples
Browse files Browse the repository at this point in the history
removed debug messages
  • Loading branch information
ck-c8y authored May 14, 2024
2 parents 622e7bc + ce01527 commit 235dc60
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions repository/blocks/EnhancedHttpOutputBlock.mon
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ event HTTPHandler
TimerParams tp := TimerParams.relative(0.01).withPayload(res).withPartition(deviceId);
base.createTimerWith(tp);

log "Called handleResponse: " + deviceId + "/" + res.payload.data.toString() at INFO;
log "Called handleResponse: " + deviceId + "/" + res.payload.data.toString() at DEBUG;
if not res.isSuccess() {
log "Unable to connect " +host+". Error code: " + res.statusMessage at WARN;
}
Expand Down Expand Up @@ -107,9 +107,9 @@ event EnhancedHTTPOutput_$Parameters {
* An example of HTTP request from the block:
* <code>
Content-Type: application/json

{
"modelName":"model_0",
"deviceId":"84588865186",
"value": {
"value":true,
"timestamp":"1563466239",
Expand Down Expand Up @@ -170,9 +170,10 @@ event EnhancedHTTPOutput {
string modelName := $modelScopeParameters.getOrDefault(ABConstants.MODEL_NAME_IDENTIFIER).valueToString();

any data;
string deviceId := AnyExtractor($activation.partition).getString("");

if $parameters.wrapBody {
data := {"modelName":<any>modelName, "value":$input_value }; // $input_value is a Value object with fields value, timestamp, properties - this will be output as a JSON object.
data := {"modelName":<any>modelName, "value":$input_value, "deviceId": deviceId }; // $input_value is a Value object with fields value, timestamp, properties - this will be output as a JSON object.
} else {
if $input_value.properties.size() = 0 {
// if properties are empty the use the input value
Expand All @@ -187,8 +188,7 @@ event EnhancedHTTPOutput {
Request req := transport.createPOSTRequest($parameters.path, data);

// Execute the request and pass the callback action.
string deviceId := AnyExtractor($activation.partition).getString("");
log "Processing for partition: " + deviceId at INFO;
log "Processing for partition: " + deviceId at DEBUG;
req.execute(HTTPHandler(deviceId, $parameters.host, $base).handleResponse);
$base.profile(BlockBase.PROFILE_OUTPUT);
}
Expand All @@ -204,7 +204,7 @@ event EnhancedHTTPOutput {
dictionary<string, any> propertyValues := {};
any k;

log "Response raw: " + response.payload.data.toString() at INFO;
log "Response raw: " + response.payload.data.toString() at DEBUG;
for k in response.payload.data.getKeys() {
propertyValues[k.valueToString()] := response.payload.data.getEntry(k);
}
Expand Down

0 comments on commit 235dc60

Please sign in to comment.