Callback: onResourceCancelObserveRequest

Last modified: Jul 5, 2019 @ 06:41

This callback notifies the gateway implementation that DDM wants to cancel the observation of changes for a resource.

The implementation is expected to respond with a ResourceObserveResponse.

The following is an example implementation of the callback:

@Override
public void onResourceCancelObserveRequest(String correlationId, String endpoint, ResourceLink resourceLink) {
  // Get the device by the endpoint value and do the following
  Path path = new Path(resourceLink.getUrl());
  if(path.isResource()) {
    // Unsubscribe to the resource of the device
  try {
      gateway.sendResourceObserveResponse(correlationId, endpoint, new ResponseCode(ResponseCode.CHANGED, ""));
    } catch (GatewayException e) {
      logger.log(Level.WARNING, "Failed to send response to DDM", e);
    }
  }
}

The following message sequence chart shows the Resource Cancel Observe process (starting at step 10).