Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: action_status on action specific stream #305

Merged
merged 5 commits into from
Nov 17, 2023
Merged

Conversation

de-sh
Copy link
Contributor

@de-sh de-sh commented Nov 16, 2023

Closes #

Changes

Why?

We seek to send action responses onto two streams of the following form:

  1. The original: /tenants/{tenant_id}/devices/{device_id}/action/status
  2. The more action specific: /tenants/{tenant_id}/devices/{device_id}/action_status/{stream_name}

The action specific topics can hence forth be subscribed to receive notifications regarding progress of an action that is of interest.

Trials Performed

  2023-11-16T13:17:35.344081Z  INFO uplink::collector::simulator: Successfully sent all action responses

  2023-11-16T13:17:35.344317Z  INFO uplink::base::bridge::actions_lane: Action response = ActionResponse { action_id: "2223", action_name: None, sequence: 10, timestamp: 1700140655344, state: "Completed", progress: 100, errors: [], done_response: None }

  2023-11-16T13:17:35.344555Z DEBUG uplink::base::serializer: publishing on /tenants/demo/devices/1002/action/status with size = 109

  2023-11-16T13:17:35.344604Z DEBUG uplink::base::serializer: publishing on /tenants/demo/devices/1002/action_status/lock with size = 109

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following is to help with custom templating of stream topics

streams.config_streams(streams_config);
streams.max_buf_size = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is to provide similar behavior from both action_status and the other response streams as otherwise we will see them pushing updates once every 100 points(MAX_BUF_SIZE) or 60 seconds(DEFAULT_TIMEOUT)

@@ -105,7 +114,7 @@ impl ActionResponse {

impl Point for ActionResponse {
fn stream_name(&self) -> &str {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An ActionResponse with action_name == None will go to the action_status stream i.e. topic: /tenants/{tenant_id}/devices/{device_id}/action/status
Whereas those with action_name == Some(stream_name) will go onto their streams and have the topic: /tenants/{tenant_id}/devices/{device_id}/action_status/{stream_name}

@de-sh de-sh marked this pull request as ready for review November 16, 2023 13:42
@de-sh de-sh changed the base branch from main to new-topic November 17, 2023 11:49
@de-sh de-sh changed the base branch from new-topic to named-topic November 17, 2023 13:30
@de-sh de-sh merged commit 6d88c28 into named-topic Nov 17, 2023
@de-sh de-sh deleted the response-topic branch November 17, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant