Callback: onResourceReadRequest

Last modified: Jul 5, 2019 @ 06:43

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

The implementation is expected to respond with a ResourceReadResponse and to send the value calling gateway.sendResourceObservationValue(senMlObject);

The following is an example implementation of the callback:

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

  SenMlObject senMlObject = new SenMlObject();
  senMlObject.setBaseTime(System.currentTimeMillis() / 1000); // unix timestamp UTC in 

  SenMlEntry senMlEntry = new SenMlEntry();

  try {
  } catch (GatewayException e) {
    logger.log(Level.WARNING, "Failed to send measurement to DDM", e);

The following message sequence chart shows the Resource Read process.