Introducing: The Client Side Event Bus in Oracle JET for decoupled interactions across templates, view models and modules with Knockout Postbox by Lucas Jellema


clip_image002Well organized exchange of client side events has been something of a holy grail for client side web development to me. I do not like these direct interactions between components that should not even know about each other. On the other hand – earlier this week I could not find out how to make components work together at all – not even in a not-so-nice-way. I decided to drop Geertjan Wielenga an email ; he is from Oracle and is one of the leading bloggers on Oracle JET. I asked him on his thoughts on a ‘client side event bus’ in JET. It turned out that he had just (as in a few minutes prior to my email) published two articles on his blog that touched on this subject. They describe how modules and template specific view models could interact in a KnockOut application such as Oracle JET. That was a great starting point. From there, I soon Googled my way into a pretty, nifty, little KnockOut extension called Postbox, introduced in 2012 and last updated in the Summer of 2015. It turns out this extension provides the event bus for client side events – in a very simple way.

The very short story:

  • Observables and regular JavaScript functions can subscribe to global topics
  • Anyone can publish to these global topics (Observables can even be tied directly to a topic, so every value change is immediately published)
  • When a message is published to a global topic, all subscribers are notified: subscribed observables are immediately updated with the published value and any subscribed functions are invoked with the published value as a parameter

This sounds simple (I hope) and it is!

In this article I will apply the Postbox mechanism to the HRM application I worked on in my previous article with Departments and Employees synchronization (Master – Detail synchronization in an Oracle JET rich client application against a REST API)

The end result will be the following interaction chain: Read the complete article here.

WebLogic Partner Community

For regular information become a member in the WebLogic Partner Community please visit: ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.

Blog Twitter LinkedIn Forum Wiki

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.