It depends what you're comparing it to.
Originally, it was used to distinguish itself from implementations where the subscribers were known to the publisher at design/compile time, i.e. the publisher effectively hardcoded all of its subscribers. This is the "oldschool" way of having one method or service call another.
In the above sense, "pub/sub" referred to a system whereby the publisher was not aware of the subscribers at design/compile time. Instead, the subscribers would add themselves to the subscription list during the publisher's runtime, as sort of a way to say "hey, let me know when there's a new thing happening please".
However, this rudimentary implementation lacked a middle man, which meant that there were certain implementation complexities such as publishers needing to be able to connect to every subscriber (causing a wide net of authorizations) and the inability to recover from an unexpected outage (e.g. a subscriber that went down or failed to handle the message from the first time).
Subsequently, event buses were created as this middle man. This changed the pub/sub game. Now, not only were publishers not aware of their subscribers at design/compile time, they weren't even aware of their subscribers at runtime either, since this is abstracted behind the event bus, as sort of a way to say "hey, I'm letting you know [this] happened, it's up to you to inform everyone who cares".
In conclusion, "pub/sub" can mean different things:
- It could refer to any implementation where the subscribers are not known to the publisher at design/compile time (i.e. when comparing to one method/service simply calling another)
- It could refer specifically to an implementation where the subscribers are not known to the publisher at design/compile time but they are known at runtime (the latter part is what distinguishes it from an event bus.
The first definition includes event buses as a form of pub/sub, the second definition intentionally excludes it.
Keep in mind that these definitions are structured by me. Maybe others prefer to think of it as everything being pub/sub and considering the existence of a broker as a secondary consideration. That's not wrong, it's just a different way of thinking about the same thing.
Is Kafka an event bus or a publisher subscriber (pubsub)pattern?
First definition says it's both; second definition says it's an event bus.