# Nameko service event\_handler as a PULL job worker

**URL:** <https://discourse.nameko.io/t/nameko-service-event-handler-as-a-pull-job-worker/296>\
**Category:** Github Issues\
**Created:** [August 13, 2018, 9:33am UTC](https://discourse.nameko.io/t/nameko-service-event-handler-as-a-pull-job-worker/296 "2018-08-13T09:33:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattbennett](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/mattbennett/32/13_2.png) [@mattbennett](https://discourse.nameko.io/u/mattbennett)\
**Post date:** [August 13, 2018, 9:33am UTC](https://discourse.nameko.io/t/nameko-service-event-handler-as-a-pull-job-worker/296/1 "2018-08-13T09:33:14Z")

</div>

_From @rizplate on Tue Mar 13 2018 04:22:53 GMT+0000 (UTC)_  
  
1- Can the event.handler/pub-sub be used as a job worker?  
i.e. instead of nameko pushing the event to the service.handler, can the service _pull_ the message so as to implement a pull based events?

2- If one event.handler event-let is taking 1 hr to complete? is every other event waiting to be delivered? i.e. none of other event.handler will run or does event-let primitively _pause_ the green-thread and give resources to other green-threads? I think resource hogger event.handler will block the whole system. any way around it?

3- Can you explain the message data flow of inbound and outbound calls of rpc i.e. which objects of nameko are doing what when the message is received.   
  
_Copied from original issue: [https://github.com/nameko/nameko/issues/522](https://github.com/nameko/nameko/issues/522)_

---

<div class="post-metadata">

**Author:** ![mattbennett](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/mattbennett/32/13_2.png) [@mattbennett](https://discourse.nameko.io/u/mattbennett)\
**Post date:** [August 13, 2018, 9:33am UTC](https://discourse.nameko.io/t/nameko-service-event-handler-as-a-pull-job-worker/296/2 "2018-08-13T09:33:17Z")

</div>

_From @mattbennett on Tue Mar 20 2018 12:15:22 GMT+0000 (UTC)_  
  
\> 1- Can the event.handler/pub-sub be used as a job worker?

Not sure what you mean by “job worker” here. Actually services _do_ pull messages from the broker, even event handlers, but perhaps what’s not obvious is that they pull up to a certain amount at a time (the “prefetch count”). By default in Nameko this value is inherited from the `max_workers` config value, which is `10`.

You can make your services look more like workers that “pull” work when the existing work is done by reducing the value of `max_workers`.

Have I understood the question correctly?

> 2- If one event.handler event-let is taking 1 hr to complete? is every other event waiting to be delivered? i.e. none of other event.handler will run or does event-let primitively pause the green-thread and give resources to other green-threads? I think resource hogger event.handler will block the whole system. any way around it?

Eventlet will yield any thread that blocks for I/O, so unless your " resource hogger" thread is unyielding then other threads will still run. If you have a workload that _is_ unyielding, you should delegate it to a [tpool](https://stackoverflow.com/questions/43947405/how-is-eventlet-tpool-useful) to avoid blocking the event loop.

> 3- Can you explain the message data flow of inbound and outbound calls of rpc i.e. which objects of nameko are doing what when the message is received.

See [this thread](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/nameko-dev/dXfzoGGbWk8) on the mailing list
