I want to create a custom node for ActiveMQ queue/topic


I’m very interested in n8n and would like to use it for my next project.

We are using ActiveMQ for events and currently we have to write listeners/connectors to many systems manually.

n8n seems like a good fit.

I’m interested to write a custom node that can connect and react to ActiveMQ events and contribute the node to the n8n community.

Before I start I wanted to ask if there are any limitations to how custom nodes work why there are no other queue-connectors yet.
Do they have timeout limitations? Is it not possible to keep a connection open to a queue for a long time?

Thanks for any input or hints that could help me in developing such a connector.



Welcome, Leo!

Great to have you here! Happy to hear that you are interested in n8n and thinking about using it.

The reason that there are no queue connectors yet is just a lack of time. Implementing them should be not complicated. There are no known limitations in n8n which should cause any problems.

A good reference is the Interval-Node. It is very simple and the implementation would be pretty much the same. You can find the code here:

You just have to implement the “trigger” function. This is the function which gets called when a workflow gets activated. There you can create the connection. Then every time a message gets received simply the this.emit function can be called with the message.
The function itself returns than simply the closeFunction which gets called when the workflow gets deactivated or n8n gets shut down (there you can close the connection to the queue). Additionally, also the manualTriggerFunction could be implemented but does not make much sense in this case. That function sends some example data when in development mode but in your case, it would not be needed as you would like to wait for an actual event and its data when testing/developing a workflow.

Hope that helps! If you have any other questions simply get back to me!

blue skies


Hi Jan

Thanks for the quick intro.

In the development guidelines, it is mentioned that you should try to avoid third-party libraries.

Does this apply to the request/http library only, or in general?

for example:
I could leverage this library: https://github.com/amqp/rhea

alternatively I could try to use activemq-REST with websocket/keep-alive and periodic reconnects.

Thanks for any guidance.

For the request/http library that is a very hard rule. As I do really not see a reason to have multiple libraries that do the same.

For other libraries that is a little bit different. If it is possible to avoid I prefer to not add them if it does not have any disadvantages and the additional work involved is reasonable. But it does also not make sense to reinvent the wheel. So, in this case, I can see why adding an external dependency makes sense. Especially does it seem like one that does not have many dependencies by itself.

I wrote something and deployed it to my local n8n installation.

When executing I get unsurprisingly:

Error: Cannot find module 'rhea'

I guess I have to checkout n8n/nodes-base from git and include it there?
There is no way nodes can load external libraries directly, right?

I was looking at your nodes, where you use an external library as well. e.g. redis


Yes, that would probably be best. Here is also a guide on how to create a node for n8n and how to set it up:

Yes, some nodes use already external dependencies. Want to however remove in the long-term some of them again. Like for example the “googleapis” as it should all be possible directly via REST. It is however still there as it was one of the first nodes I ever created for n8n and so it stayed behind. And because the library was now already there anyway, I also reused it in the Google Drive node.

Sorry for the many questions.
I have n8n running in dev mode, but I can’t find the webpack.config.js

Because I want to add:

 devServer: {
    disableHostCheck: true

I work on remote machines and use VSC remote workspace.
Currently I’m getting a image

There is no webpack.config.js. But you can check the /n8n/packages/editor-ui/vue.config.js maybe you can set it there.

never mind, stupid user error.

My first draft of the listener.

Let me know if you have any comments.

Will now try to make a simple sender.
Hope to open a PR today.

Great, just checked it out. Looking very good!

Some comments:

  • I would probably move host & port into the credentials and make them required. After all, it is a unit and they belong together. Even though host and port do not have to get saved encrypted it makes it easier for the user to define all of that once and then simply select them instead of having to define them again and again. The credentials can there also be imagined as connections to make it convenient for the users. Also if the host will change in the future will they have to change it only once in the credentials and not separate on every node in every workflow.
  • You are right, the “manualTriggerFunction” does not make sense here and can simply be omitted.
  • I think the linter is to set up to complain if callback functions are defined like this: function(a) { ... }. You should therefore normally use the short syntax (a) => {...}. But you can check by running npm run lint. The same when defining “port: port,” in line 98. The short form port, should be used.

Those are at least the things that jumped in my eye without downloading and testing it.

Thanks a lot for your work! Looking forward adding it to n8n!

I’m getting a missing “lint”

Is there another way to trigger the linter.

Uh strange. Thought it was In the package.json. Sadly not in front of my computer. So can not check. But you should be able to add it manually with npm I tslint

No worries,

I have opened a PR:

I couldn’t get lint to work, I’m not good with npm/webpack stuff.
If you have some points I can try again and adjust the code.

Great, thanks a lot I will check it out tomorrow. Have a nice evening!