X Tutup
Skip to content

Add streaming events API#57

Merged
marcuslinke merged 5 commits intodocker-java:masterfrom
almonteb:events
Sep 22, 2014
Merged

Add streaming events API#57
marcuslinke merged 5 commits intodocker-java:masterfrom
almonteb:events

Conversation

@almonteb
Copy link
Copy Markdown
Contributor

No description provided.

@marcuslinke
Copy link
Copy Markdown
Contributor

@almonteb Thanks for your contribution! But lets discuss... what do you think of push instead of pull? Maybe we need both? I mean polling for an event isn't the best option from the user perspective. Wouldn't it be better to allow registration of a callback that is called by EventStream when an event arises? In this case the name EventStream may be wrong. WDYT?

@almonteb
Copy link
Copy Markdown
Contributor Author

Actually I like your idea of a callback better. How do you feel about letting the user control the threading for this too? We'll just do the call and everything else on the current thread.

@patelrit
Copy link
Copy Markdown
Contributor

+1 for events callback. We had this working with the older version of the
api and can contribute.

On Fri, Sep 19, 2014 at 10:20 AM, Brendan Almonte notifications@github.com
wrote:

Actually I like your idea of a callback better. How do you feel about
letting the user control the threading for this too. We'll just do the call
and everything else on the current thread.


Reply to this email directly or view it on GitHub
#57 (comment)
.

Ritesh
Co-founder @ Nirmata http://nirmata.com/

https://www.youtube.com/watch?feature=player_embedded&v=UuXbggrppUE

@marcuslinke
Copy link
Copy Markdown
Contributor

@patelrit Could you point us to the appropriate code please?

@almonteb Not sure about this but for the user it would be even simpler if the API itself starts an internal thread that drives the registered callbacks.

What about to use the EventsCmdImpl command itself for both the callback registration (via fluent style withEventCallback(EventCallback eventCallback method) as well as the thread handling. Then there is no need to return an EventStreamobject and exec() may return void and starts the thread.

The current command like API style allows to start a command via exec() but not to stop it. So we could add a stop() method to the EventsCmdinterface that stops the internal thread again

Don't know if this would be hard to implement . Its just a quick idea...

@almonteb
Copy link
Copy Markdown
Contributor Author

Whoops, this is incomplete, needed to get my code online so I could finish it from home. Didn't realize pushing this would add to the pull req. Ignore 3d2a3f0

marcuslinke added a commit that referenced this pull request Sep 22, 2014
Add streaming events API
@marcuslinke marcuslinke merged commit 267f237 into docker-java:master Sep 22, 2014
@marcuslinke
Copy link
Copy Markdown
Contributor

@almonteb Thanks again for your effort!

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.

3 participants

X Tutup