-
Notifications
You must be signed in to change notification settings - Fork 51
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
[CloudSync] Adding the API to be exposed to thirdparty for Data Publish #446
Conversation
Signed-off-by: Nitu Gupta <[email protected]>
779ac43
to
2ef35ea
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution.
Please take a look at my comments.
} | ||
cloudsyncmgr.GetInstance().StartCloudSync(url) | ||
for mqttmgr.GetClient() == nil { | ||
//Wait till the client is set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long have you took? How about calling sleep function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If using sleep what time value would be used. Its not always same in settting client
@@ -351,6 +359,101 @@ SEND_RESP: | |||
h.helper.Response(w, respEncryptBytes, http.StatusOK) | |||
} | |||
|
|||
// APIV1RequestCloudSyncmgrPost handles cloudsync publish request from service application | |||
func (h *Handler) APIV1RequestCloudSyncmgrPost(w http.ResponseWriter, r *http.Request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I call this 10 times with the same host, will 10 mqtt client go routines be created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently it is not storing the client data. Also one more thing when same host is sending the conenctn request the previous connection is closed and new is opened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to make the base code with single connection with the client. Going forward we think of scenarios where multiple service applications can call the send API to send data to different broker URL's. So in that case maintaining separate mqtt client instance for each service application would be better(and only one instance for each host). Use of db to maintain the same or so could be option. We plan to do this once the base code is merged as part of next steps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Signed-off-by: Nitu Gupta [email protected]
Description
provide mechanism to expose API that can be used by third party apps to publish data to MQTT broker running on AWS endpoint
Fixes # (#382 )
Type of change
How Has This Been Tested?
1.MQTT mosquitto broker is configured to be running in the AWS endpoint.
2. The edge orchestration is build and run using following command with option CLOUD_SYNC set to true
Test Configuration:
Checklist: