Skip to content

Commit

Permalink
Merge pull request #32 from SoftwareAG/feature-new-samples
Browse files Browse the repository at this point in the history
fixing bugs
  • Loading branch information
ck-c8y authored May 13, 2024
2 parents 63b750a + 8bc7b72 commit 5b3b843
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions repository/blocks/EnhancedHttpOutputBlock.mon
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ using com.softwareag.connectivity.httpclient.Response;
event HTTPHandler
{
string deviceId;
float timeout;
string host;
/** Handle the HTTP response.*/
action handleResponse(Response res) {
// $base.createTimer(($parameters.timeout.toFloat() / 1000.0), res); // Creates a timer with the specified duration.
TimerParams tp := TimerParams.relative($parameters.timeout.toFloat() / 1000.0).withPayload(res)
.withPartition(deviceId));
TimerParams tp := TimerParams.relative(timeout).withPayload(res).withPartition(deviceId);

log "Called handleResponse: " + res.payload.data.toString() at INFO;
if not res.isSuccess() {
log "Unable to connect " +$parameters.host+". Error code: " + res.statusMessage at WARN;
log "Unable to connect " +host+". Error code: " + res.statusMessage at WARN;
}
}
}
Expand Down Expand Up @@ -195,7 +196,7 @@ event EnhancedHTTPOutput {
// Execute the request and pass the callback action.
string deviceId := $activation.partition.toString();
log "Processing for partition: " + deviceId at INFO;
req.execute(HTTPHandler(deviceId).handleResponse);
req.execute(HTTPHandler(deviceId, $parameters.timeout.toFloat() / 1000.0, $parameters.host).handleResponse);
$base.profile(BlockBase.PROFILE_OUTPUT);
}

Expand Down

0 comments on commit 5b3b843

Please sign in to comment.