6 : The wheels on the (service) bus

21 Jan 2022

Rowan and Andy are discussing what a service bus is, examples of various service bus implementations and when you'd use it over something like a queue.

Random fact

A teaspoonful of neutron star would weigh 6 billion tons!!

A neutron star is the remnants of a massive star that has run out of fuel. The dying star explodes in a supernova while its core collapses in on itself due to gravity, forming a super-dense neutron star.

Astronomers measure the mind-bogglingly large masses of stars or galaxies in solar masses, with one solar mass equal to the Sun’s mass.

The sun has a mass of 2,000,000,000,000,000,000,000,000,000 (2 + 27 0's) (2 octillion) tonnes which represents 99.9% of the solar system's total mass

Typical neutron stars have a mass of up to three solar masses, which is crammed into a sphere with a radius of approximately ten kilometres (6.2 miles) – resulting in some of the densest matter in the known universe

Simple explanation

A neutron star is very small radius (typically 30 km) and very high density, composed predominantly of closely packed neutrons.

Neutron stars are thought to form by the gravitational collapse of the remnant of a massive star after a supernova explosion, provided that the star is insufficiently massive to produce a black hole.


This week we've been discussing how to solve the problem of how to broker messages between 2 separate components in a system that we work on. We got to discussing the option of using a service bus to broker these messages, which got us discussing the topic of the service bus.

So all aboard for a ride on the service bus 😉

  • What is a service bus or an Enterprise service bus (ESB)

    • It provides a communication between parts of a system
      • Introduced with Service Oriented Architecture (SOA)
      • A Service Bus acts as yet another layer of abstraction in the never ending quest to implement a good Service Oriented Architecture. The Service Bus can handle some of the heavy lifting seen behind a good Service Oriented Architecture like Messaging, Routing, and Service Co-Ordination.
      • Ideally, the ESB should be able to replace all direct contact with the applications on the bus, so that all communication takes place via the ESB.
  • Examples of service buses

  • When do you need to use one?

    • Does add complexity - more to manage
    • Hand off long running/intensive processes
    • Loosely coupling systems - communication between systems
    • A rule of thumb could by if it solves more problems than it causes.
  • Is a Service Bus different to a queue? What are the differences?

    • The lines have become blurred recently as some products now support features that previously belonged to one or the other
  • When would you use a queue vs a service bus?

    • A queue is FIFO - can be important in some situations
  • How does using a service bus to communicate between services differ to using http calls?

    • asynchronous vs synchronous - wait on response of http call
    • coupling - need to know (or have co-ordinator) the address
    • durability - messages are stored on disk
    • error recovery / retries
    • eventual consistency
    • challenges with eventual consistency vs immediate consistency
      • data partitioning / sync
      • data referential integrity
      • how does that affect CRUD operations?
        • makes it harder
  • Will a service bus allow you to setup a pub / sub based architecture?

    • Yes - this is the common pattern that service buses offer - a single producer and many consumers. Consumers can come and go without needing to change the source application. Really good design for scalability - both producers and consumers can be adjusted to meet your changing requirements.
  • How about Event Sourcing - can a service bus be used to communicate events?

    • Yes you could send all events via a service bus and then do whatever is required with them
    • Would you use a Bus with Kafka, or EventStore for example? - Probably not as these are event sourcing/streaming platforms in their own right - but you could if it's the correct architecture
  • How about CQRS - can a service bus be used to communicate command / queries requests?

    • It can be but it isn't necessary. It's a technology that can be used to implement CQRS.
    • CQRS simply means decomposing your application so that the Read and Write parts of your application can be optimized for the respective concern.
  • Does using a service bus impact the way you would design your services?

    • Asynchronous / vs synchronous operations
      • eventual consistency affect UI design
      • Create operations may not make data immediately available
    • Depends - in some cases yes (UI design - not getting an immediate response) in other cases no - don't care what happens, fire and forget
    • Idempotent operations for retries - You need to be able to deal with failures and duplicates

OS project/utility of the week

Windows Terminal:

Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includes many of the features most frequently requested by the Windows command-line community including support for:

  • tabs
  • rich text
  • globalization
  • configurability
  • theming & styling,
  • GPU-accelerated text rendering engine - easy to switch themes
  • All your bash / consoles in one, even WSL!

More recent versions provide a GUI for config whereas earlier versions just exposed the settings.json file - now there is GUI config available for:

  • creating and configuring each profile
    • default profile
    • command line exe to run for that console
    • appearance

It is making great progress

  • Latest version:
    • Windows Terminal v1.11.2921.0
    • v1.12 preview is currently available
    • You must be running Windows 1903 (build >= 10.0.18362.0) or later to run Windows Terminal

All open development on GitHub: