# Can one event\_handler handle multiple types of events?

**URL:** <https://discourse.nameko.io/t/can-one-event-handler-handle-multiple-types-of-events/515>\
**Category:** Uncategorized\
**Created:** [November 6, 2019, 12:38am UTC](https://discourse.nameko.io/t/can-one-event-handler-handle-multiple-types-of-events/515 "2019-11-06T00:38:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bschwyn](https://avatars.discourse-cdn.com/v4/letter/b/e5b9ba/32.png) [@bschwyn](https://discourse.nameko.io/u/bschwyn)\
**Post date:** [November 6, 2019, 12:38am UTC](https://discourse.nameko.io/t/can-one-event-handler-handle-multiple-types-of-events/515/1 "2019-11-06T00:38:50Z")

</div>

I have a number of different services that each publish events, and then one service which subscribes to all of them and does the same/similar things with each.

I was wondering if instead of:

```auto
@event_handler("source1", "event_type1")
def do_something1(payload):
    #do thing

@event_handler("source1", "event_type2")
def do_something2(payload):
    #do thing
    #do another thing

@event_handler("source2", "event_type3")
def do_something3(payload):
   #do thing

```

I could instead do something like:

```auto
@event_handler(source, event_type)
def do_something(payload):
    #do a thing
    #if event_type == "eventy_type3":
        #do another thing

```

---

<div class="post-metadata">

**Author:** ![litmax](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/litmax/32/67_2.png) [@litmax](https://discourse.nameko.io/u/litmax)\
**Post date:** [November 21, 2019, 11:31am UTC](https://discourse.nameko.io/t/can-one-event-handler-handle-multiple-types-of-events/515/2 "2019-11-21T11:31:37Z")

</div>

What if you use dictionary like this:

```auto
event = {'event_type': 'event1', 'data': data}

```

?
