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

Feature/runset #128

Closed
wants to merge 1 commit into from
Closed

Feature/runset #128

wants to merge 1 commit into from

Conversation

db7
Copy link
Collaborator

@db7 db7 commented May 1, 2018

Introduce runsets to control the lifecycle of views and processors (runnable interface).

Here is an example of how to use runsets:

// create processors and views (they are runnables because have Run(ctx) method)
p, _ := NewProcessor(brokers, DefineGroup(group, Input(topic, codec, cb)))
v, _ := NewView(brokers, topic2, codec)

// start runnables creating a Runset.
rs := Start(p,v)

// wait for bad things to happen
wait := make(chan os.Signal, 1)
signal.Notify(wait, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM)
select {
case <-rs.Done(): // wait for one of the runnables to return
case <-wait:      // wait for SIGINT/SIGTERM
	rs.Stop() // gracefully stop runnables
}

// wait for all runnables to return and collect error messages
if err := rs.Wait(); err != nil {
	log.Fatalln(err)
}

@db7 db7 closed this May 15, 2018
@db7 db7 deleted the feature/runner branch October 23, 2018 13:49
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