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

docs(app-sdk): Add background publisher API detail #229

Merged
merged 2 commits into from
Oct 2, 2020
Merged

docs(app-sdk): Add background publisher API detail #229

merged 2 commits into from
Oct 2, 2020

Conversation

AlexCuse
Copy link
Contributor

@AlexCuse AlexCuse commented Sep 4, 2020

Adds a simple paragraph and code example for using background publisher
API

References: #462

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number:
462

What has been updated?

Are there any specific instructions or things that should be known prior to reviewing?

Other information

@AlexCuse
Copy link
Contributor Author

AlexCuse commented Sep 4, 2020

Please note - this is a draft PR for the hanoi release, linked to edgexfoundry/app-functions-sdk-go#466

defer close(done)

//pass the publisher to your jobs
for _, j := range jobs {
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be helpful to show example of Job using the publisher to send the data to complete the picture. Also jobs isn't define in sample so might want to change comment to pass the publisher to your jobs (defined elsewhere) .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this idea to show a more detailed example, I'll just code a simple loop to use it inline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left the actual message construction as an exercise for the user, but added a simple method demonstrating usage of the publisher to the doc. Tried not to make the code sample too much longer so I left out logging calls etc...

@lenny-goodell lenny-goodell marked this pull request as draft September 4, 2020 23:33
@lenny-goodell
Copy link
Member

Please note - this is a draft PR for the hanoi release, linked

There is a drop down when you create the PR where you can select Draft or a small link at the top right under the reviews that allows you to changes it to Draft, which is what I did.

if err != nil {
continue
}
pub.Publish(, fmt.Sprintf("background=%d", time.Now().UnixNano()), clients.ContentTypeJSON)
Copy link
Member

Choose a reason for hiding this comment

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

Missing payload as first parameter.
Also recommend set correlationId = uuid.New().String() and passing it to Publish so it is more explicit and uses standard UUID used else where for correlation ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh should be good now

Adds a simple paragraph and code example for using background publisher
API

References: #462
Signed-off-by: Alex Ullrich <[email protected]>
lenny-goodell
lenny-goodell previously approved these changes Sep 8, 2020
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@lenny-goodell lenny-goodell added hanoi Hanoi release hold Intended for PRs we want to flag for ongoing review labels Sep 9, 2020
@lenny-goodell lenny-goodell removed the hold Intended for PRs we want to flag for ongoing review label Oct 2, 2020
@lenny-goodell lenny-goodell marked this pull request as ready for review October 2, 2020 17:03
@lenny-goodell lenny-goodell merged commit b9357a8 into edgexfoundry:master Oct 2, 2020
edgex-jenkins added a commit that referenced this pull request Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hanoi Hanoi release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants