N8N Community node: Introducing Workflow PubSub for effortless workflow decoupling

This package provides custom nodes for n8n that allow seamless event-driven communication between workflows within the n8n ecosystem, creating a flexible, decoupled way to manage interactions between workflows.

This is my first community node, enjoy!




3 Likes

Am trying to undersatnd what this node does but am lost. Could you explain?

Imagine it as the Execute Workflow node and trigger, but you don’t specify what workflow to execute. Instead, you emit an event and choose what event to subscribe to in the trigger. Many workflows can subscribe to single event (or even multiple events using regexp filter!) without modifing the emitting workflow (decoupling).
Usually you would use something like RabbitMQ or Redis pubsub. Workflow PubSub allows you to do that without external event bus.

1 Like

This is awesome, but how does it work?
Is it just saved in code? Then it would not work with Queue mode I guess?

There’s a global array where the triggers store their emit callbacks with event filters. The publishing node just iterates over those callbacks and passes it’s event name and input data to them.
Currently it works for my use cases. I have to look up what the queue mode is.

Ah ok, yeah that is what I thought you were doing.
Might actually work for Queue mode, as the main instance should be the one triggering the flow so that would have access to the global array.

Great idea, @koubas!

1 Like

Whoah, that´s a really nice piece of work. Thank you!

Hey @koubas , Great work! Horewer I can confirm it isn’t working with Queue mode unfortunately.

Excellent concept, definitely a time saver for so many cases!

That’s sad :frowning: I’ll look into it to see what can be done about that. Currently, it serves me well as a great solution for simple setups. For larger setups, you could use an external service like RabbitMQ, Redis, Google PubSub, or similar.

1 Like

Awesome! Much better than the too simple Sub flow calling by n8n. I think it will solve my problem that I would like to get triggered by a Sub-Flow in my main flow, which is impossible otherwise in N8N.

My use case: I use an API in my Sub-Flow which is async, and that API calls me back on a Webhook when finshed. I need to somehow pass that back to my main flow. With this nodes I can simply call (from my subflow after the webhook is received) the trigger in my main flow via this internal messaging. This makes my workflows way more “arranged” and I can keep functionality visually together.