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

NOISSUE - Fix opcua-adapter events decode #951

Merged
merged 6 commits into from
Nov 25, 2019
Merged

NOISSUE - Fix opcua-adapter events decode #951

merged 6 commits into from
Nov 25, 2019

Conversation

manuio
Copy link
Contributor

@manuio manuio commented Nov 15, 2019

With an existing event processing implementation, whenever the processor receives a new event with some unexpected format it will break. This implementation should be able to handle unexpected metadata formats in a better way.

@manuio manuio requested a review from a team as a code owner November 15, 2019 15:52
@codecov-io
Copy link

codecov-io commented Nov 15, 2019

Codecov Report

Merging #951 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #951   +/-   ##
=======================================
  Coverage   83.75%   83.75%           
=======================================
  Files          75       75           
  Lines        5307     5307           
=======================================
  Hits         4445     4445           
  Misses        587      587           
  Partials      275      275

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8ac6ca...5d6b0a9. Read the comment docs.

@@ -53,16 +53,16 @@ func (b client) Subscribe(cfg opcua.Config) error {
}

c := opcuaGopcua.NewClient(ep.EndpointURL, opts...)
if errC := c.Connect(b.ctx); err != nil {
b.logger.Error(errC.Error())
if errc := c.Connect(b.ctx); errc != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just follow err propagation? Why new var errc and errs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, err is a special var in Go that can be re-assigned with :=

@@ -89,12 +93,12 @@ func (es eventStore) Subscribe(subject string) error {
}
err = es.handleCreateThing(cte)
case thingUpdate:
ute, derr := decodeUpdateThing(event)
ute, derr := decodeCreateThing(event)
Copy link
Collaborator

Choose a reason for hiding this comment

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

derr ? why not err ?

nmarcetic
nmarcetic previously approved these changes Nov 15, 2019
opcua/redis/events.go Outdated Show resolved Hide resolved
opcua/redis/streams.go Outdated Show resolved Hide resolved
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
if errC := c.Connect(b.ctx); err != nil {
b.logger.Error(errC.Error())
if err := c.Connect(b.ctx); err != nil {
return fmt.Errorf("Failed to connect: %s", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use our errors package here, something like: errors.Wrap(ErrFailedConn, err).

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
drasko
drasko previously approved these changes Nov 22, 2019
Copy link
Contributor

@drasko drasko left a comment

Choose a reason for hiding this comment

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

LGTM

@drasko drasko dismissed their stale review November 22, 2019 20:31

Dismissing until Dusan's remarks are not taken into account.

manuio and others added 2 commits November 25, 2019 13:20
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Copy link
Contributor

@anovakovic01 anovakovic01 left a comment

Choose a reason for hiding this comment

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

LGTM!

@nmarcetic nmarcetic merged commit 8602185 into absmach:master Nov 25, 2019
manuio added a commit that referenced this pull request Oct 12, 2020
* NOISSUE - Enable multi OPC-UA Subscriptions

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* NOISSUE - Fix opcua-adapter events decode

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use a config file to subscribe to multiple nodes

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add subscription config file

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Use Mainflux errors package

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
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.

6 participants