Moleculer: Using two different transporters

Created on 23 Dec 2020  路  2Comments  路  Source: moleculerjs/moleculer

We would like to be able to use two different types of transporters (specifically TCP & MQTT) and be able to "tell" each call which transporter to use. We would also like that the MQTT will be a fallback to the TCP.

My guess is that it will be possible by sending the transporter option an array instead of a string/object/class.
But that will also mean a huge change in code in the initialization and the send function as well.

I thought about using the custom transporter option to initialize 2 different transporters of my choice and implement the "send" function with the fallback I need (using the meta to know which transporter to try first).

I wanted to know if that's an option someone already thought of or if you have any idea on how to do something like that.

K枚szenem szepen!

Most helpful comment

Hi @bar-colu, yeah, the codebase supports only one transporter, and it would be hard to change it. Your custom transporter can be a good option. Another option is maybe the inter-namespace middleware. You can define multiple brokers with different settings.

All 2 comments

Hi @bar-colu, yeah, the codebase supports only one transporter, and it would be hard to change it. Your custom transporter can be a good option. Another option is maybe the inter-namespace middleware. You can define multiple brokers with different settings.

Thanks @icebob will look into it!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dylanwulf picture dylanwulf  路  4Comments

rozhddmi picture rozhddmi  路  4Comments

abdavid picture abdavid  路  4Comments

maitrucquynhq111 picture maitrucquynhq111  路  3Comments

DeividasJackus picture DeividasJackus  路  4Comments