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.
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.
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.
That’s sad 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.
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.