GithubHelp home page GithubHelp logo

Comments (5)

talentdeficit avatar talentdeficit commented on June 2, 2024

this needs tests obviously, but is there any reason this couldn't be merged?

https://github.com/talentdeficit/gen_stage/tree/async_events

from gen_stage.

josevalim avatar josevalim commented on June 2, 2024

The producer doesn't have to answer immediatialy. It is totally fine to
store the demand and serve that later on. That's why all callbacks can
potentially return events. The GenEvent example in the examples folder and
in the announcement does that.

The notification is used for other goals. You can check the Naiad project
from Microsoft, which is where we got the notifications from, but in
summary it can be used to notifiy consumers that the source has exhausted
or halted or to notify a new window of processing has started and so on. It
has the property of keep the ordering from events, even if those events
have been buffered somewhere.

On Thursday, July 14, 2016, alisdair sullivan [email protected]
wrote:

As far as I can tell if a consumer requests events the producer must
immediately return that many events in the handle_demand callback or the
producer has to drop down to the raw message protocol to send events
asynchronously. Otherwise the consumer has to issue another request in
order to ever receive any events.

Is async_notify/sync_notify meant to be used for this purpose? how is an
callback module supposed to handle notify messages? raw interpretation of
the notify message in handle_info?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/elixir-lang/gen_stage/issues/38, or mute the thread
https://github.com/notifications/unsubscribe/AAAlbif8hfU0boQt_08NbWhv6FsrxleKks5qVn1PgaJpZM4JMtNC
.

José Valim
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

from gen_stage.

josevalim avatar josevalim commented on June 2, 2024

To further expand, you never want to send events asynchronously because it
means we won't be able to track the demand and you will lose ordering in
case there are buffers. If you send events async, the consumer will
eventually complain it has gotten more events than it has asked for.

José Valim
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

from gen_stage.

talentdeficit avatar talentdeficit commented on June 2, 2024

i understand now why i wouldn't want to send events directly to a client async and i guess if i want to produce events asynchronously i could use handle_call/3, thanks

from gen_stage.

josevalim avatar josevalim commented on June 2, 2024

@talentdeficit you would need to send those messages to the producer so it finally sends them downstream or figure out a way of having multiple producers so you could leverage concurrency from this other angle.

from gen_stage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.