Callback: onResourceWriteRequest

Last modified: Jul 5, 2019 @ 06:43

This callback notifies the gateway implementation that DDM wants to write the value of a resource.

The implementation is expected to respond with a ResourceWriteResponse.

The following is an implementation example of the callback:

@Override
public void onResourceWriteRequest(String correlationId, String endpoint, ResourceLink resourceLink) {
  // Get the device by the endpoint value and write to the resource
  ResponseCode responseCode = new ResponseCode(ResponseCode.CONTENT, "Writing resource was easy.");
  try {
    getGateway().sendResourceWriteResponse(correlationId, endpoint, responseCode);
  } catch (GatewayException e) {
    logger.log(Level.WARNING, "Failed to send response to DDM", e);
  }
}

The following message sequence chart shows the Resource Write process.