#10 Event handlers can return values to emiters

닫힘
msieron6 년 전을 오픈 · 5개의 코멘트
msieron 코멘트됨, 6 년 전

New interface, similar to EventListener, to handle responses from event handlers.

Synchronous model should look like:

  • Method #handleEvent should return generic value.
  • value should be intercepted by EventListener and passed to EventRouter
  • EventRouter#signalEvent should return this value

That model is obviously incompatible with whole concept of event model, so we have to think about something different, like "callback events". Callback event could be possibly implemented without changing current implementation. It would be enough to introduce new type of event with correlation id: correlation id could be used to process responses.

On top of asynchronous model we could write two kind of simple utility classes:

  • for synchronous model: class will wait for correlated events using event locks
  • for callback model: class will put handle inside internal queue. It will be processed later on event receive.

We need synchronous model if we want to implement event model with rejection: e.g. veto property change.

New interface, similar to EventListener, to handle responses from event handlers. Synchronous model should look like: - Method #handleEvent should return generic value. - value should be intercepted by EventListener and passed to EventRouter - EventRouter#signalEvent should return this value That model is obviously incompatible with whole concept of event model, so we have to think about something different, like "callback events". Callback event could be possibly implemented without changing current implementation. It would be enough to introduce new type of event with correlation id: correlation id could be used to process responses. On top of asynchronous model we could write two kind of simple utility classes: - for synchronous model: class will wait for correlated events using event locks - for callback model: class will put handle inside internal queue. It will be processed later on event receive. We need synchronous model if we want to implement event model with rejection: e.g. veto property change.
msieron 코멘트됨, 6 년 전
협업자

New models:

  1. asynchronous: signal action, execute in router
  2. asynchronous: signal action, execute in router, signal result
  3. asynchronous: query & response correlated by id, using (2)
  4. asynchronous: signal action, execute in router, process result in router?
  5. pipeline (generalization of (4))
  6. semi-synchronous: signal & wait for response, using (2)

Functionality:

  • Support for many responses (we can use java collectors)
  • Support for pre-event & post-events for executable actions
  • Support for event cancelation in pre-event handlers
New models: 1. asynchronous: signal action, execute in router 2. asynchronous: signal action, execute in router, signal result 3. asynchronous: query & response correlated by id, using (2) 3. asynchronous: signal action, execute in router, process result in router? 4. pipeline (generalization of (4)) 5. semi-synchronous: signal & wait for response, using (2) Functionality: - Support for many responses (we can use java collectors) - Support for pre-event & post-events for executable actions - Support for event cancelation in pre-event handlers
msieron 코멘트됨, 6 년 전
협업자

New model: client/broker.

  • create EventRouter from interface/class which delegates work reflectively.
  • broker should use (2) to send results to other listeners
  • client should find router, send events to it and offer both sync/callback methods for waiting on results.
New model: client/broker. - create EventRouter from interface/class which delegates work reflectively. - broker should use (2) to send results to other listeners - client should find router, send events to it and offer both sync/callback methods for waiting on results.
msieron 코멘트됨, 6 년 전
협업자

Implemented models:

  1. TaskRouter signal action, execute in router
  2. TaskRouter signal action, execute in router, invoke callback (by the same or another router)
  3. TaskRouter signal action, execute in router, wait for result
  4. TaskBroker interface producer/consumer

Required models:

  • (1)
  • (2) only internally
  • (3)
  • (4)
  • (5) not yet
  • (6)

Required functionality:

  • Support for many responses (we can use java collectors)
  • Support for pre-event & post-events for executable actions
  • Support for event cancelation in pre-event handlers
Implemented models: 1. `TaskRouter` signal action, execute in router 1. `TaskRouter` signal action, execute in router, invoke callback (by the same or another router) 1. `TaskRouter` signal action, execute in router, __wait__ for result 1. `TaskBroker` interface producer/consumer Required models: - (1) - (2) only internally - (3) - (4) - (5) not yet - (6) Required functionality: - Support for many responses (we can use java collectors) - Support for pre-event & post-events for executable actions - Support for event cancelation in pre-event handlers
msieron 코멘트됨, 6 년 전
협업자

Todo:

  • (5) pipeline

Functionality:

  • ActiveEvent can be canceled by ActiveEventListener
  • we can wait for ActiveEvent completion
  • ActiveEventListener does not allow return values
  • maybe we could extend ActiveEvent further to add modifiable result field (not only canceled/processed status)
Todo: - (5) pipeline Functionality: * `ActiveEvent` can be canceled by `ActiveEventListener` * we can wait for `ActiveEvent` completion * ActiveEventListener does not allow return values * maybe we could extend ActiveEvent further to add modifiable result field (not only canceled/processed status)
msieron 코멘트됨, 6 년 전
협업자

Final models:

  • TaskRouter: can schedule and optionally wait for Runnable.
  • TaskRouter: can schedule and optionally wait for Supplier.
  • TaskRouter: callback support
  • TaskBroker: use interface for messaging between producer/consumer

Final functionality:

  • ActiveEvent: event can be canceled
  • ActiveEvent: we can wait for completion
  • ActiveEvent: we can write subclasses to deliver results
Final models: - TaskRouter: can schedule and optionally wait for Runnable. - TaskRouter: can schedule and optionally wait for Supplier. - TaskRouter: callback support - TaskBroker: use interface for messaging between producer/consumer Final functionality: - ActiveEvent: event can be canceled - ActiveEvent: we can wait for completion - ActiveEvent: we can write subclasses to deliver results
msieron 커밋 6 년 전에서 이 이슈 언급
로그인하여 이 대화에 참여
마일스톤 없음
담당자 없음
참여자 1명
로딩중...
취소
저장
아직 콘텐츠가 없습니다.