How to Embed hivemq in java process

New to MQTT, and HiveMQ.
We need to embed HiveMQ in our java application (on jdk 14). Is there any guide or instructions for embedded deployment of HiveMQ? The main question I have is how to tell HiveMQ where the config files are.


Hello @friendshipseeker

Welcome to the HiveMQ Community Forum! We’re delighted to see your interest in MQTT and HiveMQ. Could you please share more details about your use case and what you are aiming to build? This information will enable us to offer you a tailored solution. Looking forward to your response.

We also recommend checking our MQTT essential series to know more about MQTT and our documentation to know more about HiveMQ

Sheetal from HiveMQ Team

Hi @friendshipseeker,

Thank you for your question!

To guide HiveMQ on where to locate the configuration files, you can refer to an example from one of HiveMQ’s open-source extensions. Here are some useful links to specific sections of the code:

I hope this helps! Please let me know if you have any other questions or need further assistance.

Best regards,
Dasha from The HiveMQ Team

Thank you for your reply. I will study the two classes.
As for our goal: We are integrating Electronic Shelf Labels (ESLs) to our point of sale system. We want to use HiveMQ as our MQTT broker/server, for several reasons, prime among them, our entire software stack is Java/JavaFX.
However, we want to have HiveMQ run as a thread in our JVM. I understand this might cause performance issues, but we don’t expect it to affect us.

When I tried to launch HiveMQ in embedded mode, I realized that I do not know how to force it to pick up the config file from a specific location. We need to be able to do this. Otherwise, I think it should work fine.

Thanks again,

Hi Al,

Integrating Electronic Shelf Labels (ESLs) with your point-of-sale system sounds like an exciting project.

From the links to the open-source code I provided earlier, it seems that you simply specify the path in the file system, read the content of the file from it, parse it, and retrieve your settings. Is the file system available for you in embedded mode?

Best regards,
Dasha from the HiveMQ Team