# Subscribe to all events from EventBus?

**URL:** <https://forum.bpmn.io/t/subscribe-to-all-events-from-eventbus/4382>\
**Category:** Modeler\
**Created:** [February 6, 2020, 3:14pm UTC](https://forum.bpmn.io/t/subscribe-to-all-events-from-eventbus/4382 "2020-02-06T15:14:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![StephenOTT](https://forum.bpmn.io/user_avatar/forum.bpmn.io/stephenott/32/1720_2.png) [@StephenOTT](https://forum.bpmn.io/u/StephenOTT)\
**Post date:** [February 6, 2020, 3:14pm UTC](https://forum.bpmn.io/t/subscribe-to-all-events-from-eventbus/4382/1 "2020-02-06T15:14:05Z")

</div>

Is it possible to subscribe to all events in the event bus? The examples I have read show usage for per event subscriptions; is there a example of a catch all? Or a maintained listing of all possible events?

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [February 7, 2020, 9:19am UTC](https://forum.bpmn.io/t/subscribe-to-all-events-from-eventbus/4382/2 "2020-02-07T09:19:55Z")

</div>

You could override the `fire` method of the event bus to log all the events that are being fired.

```javascript
class EventBusLogger {
  constructor(eventBus) {
    const fire = eventBus.fire.bind(eventBus);

    eventBus.fire = (type, data) => {
      console.log(type, data);

      fire(type, data);
    };
  }
}

```

Example: [https://codesandbox.io/s/bpmn-js-log-events-h3d94](https://codesandbox.io/s/bpmn-js-log-events-h3d94)

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [February 7, 2020, 10:06am UTC](https://forum.bpmn.io/t/subscribe-to-all-events-from-eventbus/4382/3 "2020-02-07T10:06:07Z")

</div>

@StephenOTT Just to understand your request a bit better: Why would you need such a list of events? What would be the use?

---

<div class="post-metadata">

**Author:** ![jitorresd](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@jitorresd](https://forum.bpmn.io/u/jitorresd)\
**Post date:** [November 16, 2020, 5:15pm UTC](https://forum.bpmn.io/t/subscribe-to-all-events-from-eventbus/4382/4 "2020-11-16T17:15:35Z")

</div>

Hello, Philipp,

I´ve tried this code. I am able to get all the events, but when I get a shape from the palette into the canvas and try to connect it to any other shape in the diagram, I get this error:

“no shape type specified”

However, this problem does not happen when I add a shape from those that show when you click an element in the diagram.

I did some testing in the sanbox and the same problem happens.

This is the stack trace of the error:

Uncaught Error: no shape type specified  
at ElementFactory.createBpmnElement (ElementFactory.js:37)  
at ElementFactory.create (ElementFactory.js:29)  
at ElementFactory.createConnection (ElementFactory.js:21)  
at ConnectionPreview.getConnection (ConnectionPreview.js:76)  
at eval (ConnectionPreview.js:28)  
at eval (ConnectionPreview.js:106)  
at ConnectionPreview.drawPreview (ConnectionPreview.js:32)  
at eval (ConnectPreview.js:15)  
at invokeFunction (EventBus.js:201)  
at EventBus.\_invokeListener (EventBus.js:126)  
at EventBus.\_invokeListeners (EventBus.js:118)  
at EventBus.fire (EventBus.js:93)  
at EventBusLogger.eventBus.fire (index.js:27)  
at fire (Dragging.js:44)  
at HTMLDocument.move (Dragging.js:88)

And finally:

Uncaught ReferenceError: keyEventHandler is not defined  
at s.onkeydown (sandbox.8fe7e72a2.js:1)

Is it necessary to handle something else?

Thanks from your answer!

---

<div class="post-metadata">

**Author:** ![barmac](https://forum.bpmn.io/user_avatar/forum.bpmn.io/barmac/32/974_2.png) [@barmac](https://forum.bpmn.io/u/barmac)\
**Post date:** [November 18, 2020, 3:54pm UTC](https://forum.bpmn.io/t/subscribe-to-all-events-from-eventbus/4382/5 "2020-11-18T15:54:09Z")

</div>

Closed on November 18, 2020, 3:54pm UTC


