How to pass mqtt5 user-properties from Hivemq swarm tool

Hi Team,
I have a use-case test to pass user-properties for each clients when it connect to broker via swarm engine and currently using hivemqSwarm-4.7.4 version
How to add mqtt5 user properties to scenario.xml or using custom extension in hivemq swarm tool.
Any way to pass user properties from SecurityProvider or PayloadGenerator from custom extensions

Thanks,
Harish

Hi Harish1,

Nice to see your interest in MQTT! Please be welcome in our community.

  • You can develop your own Custom Extension for HiveMQ Swarm, such as a SecurityProvider and PayloadGenerator.
  • You can add additional arguments for your SecurityProvider and PayloadGenerator as xml attributes.

For example, set attribute foo for SecurityProvider in your scenario.xml connect tag:

<connect securityProvider="my-security-provider" foo="myAttribute"/>

Access the attribute foo from the SecurityProvider implementation:

extensionContext.getExtensionRegistry().addSecurityProvider("my-security-provider", (input, output) -> {
    input.getAdditionalAttributes("foo");
});

You will find documentation here: HiveMQ Swarm Extensions :: HiveMQ Documentation

I hope this helps,
Dasha from HiveMQ Team

One quick follow-up question on the additional arguments.
After reading property from xml like below, how we can pass it to the broker which we want to test use-case.

input.getAdditionalAttributes(“foo”);

I see the method userNamePassword() in output. which is taking username and pwd.
Any other method , using that we can pass additional attributes to broker.

Thanks,
Harish

Hi Harish1,

you could implement a custom payload generator and use additional params to generate your payload.

Additional Attributes for Payload Generators

<publish payloadGeneratorType="my-payload-generator" bar="myAttributes"/>
extensionContext.getExtensionRegistry().addPayloadGenerator("my-payload-generator", payloadGeneratorInput -> {
    input.getAdditionalAttributes("bar");
});

There seems to other method at the moment.

Regards,
Dasha from HiveMQ Team

Hi Daria_H,
My ask is how to add user properties to tag itself not
My use-case is like , ex: mosquitto is the broker and it requires more details other than username and passwords to get authenticated.
How can i achieve that using swarm extension.

Thanks,
Harish

Hi Harish,

Unfortunately at the moment HiveMQ Swarm does not have this feature to set userProperties by the user. Unfortunately we cannot provide a solution how to achieve this using Swarm extension.

Kind regards,
Dasha from HiveMQ Team