UNPKG

@gatling.io/mqtt

Version:

Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).

196 lines (195 loc) 6.67 kB
import { CheckBuilder, Duration, ProtocolBuilder, Session } from "@gatling.io/core"; import { LastWillBuilder } from "./lastWill"; export interface MqttProtocolBuilder extends ProtocolBuilder { /** * Use MQTT 3.1 * * @returns a new MqttProtocolBuilder instance */ mqttVersion_3_1(): MqttProtocolBuilder; /** * Use MQTT 3.1.1 (default) * * @returns a new MqttProtocolBuilder instance */ mqttVersion_3_1_1(): MqttProtocolBuilder; /** * Use MQTT 5 * * @returns a new MqttProtocolBuilder instance */ mqttVersion_5(): MqttProtocolBuilder; /** * Define the MQTT broker address * * @param hostname - the hostname * @param port - the port * @returns a new MqttProtocolBuilder instance */ broker(hostname: string, port: number): MqttProtocolBuilder; /** * Use TLS * * @param useTls - true to enable TLS * @returns a new MqttProtocolBuilder instance */ useTls(useTls: boolean): MqttProtocolBuilder; /** * Define the clientId * * @param clientId - the clientId, expressed as a Gatling Expression Language String * @returns a new MqttProtocolBuilder instance */ clientId(clientId: string): MqttProtocolBuilder; /** * Define the clientId * * @param clientId - the clientId, expressed as a function * @returns a new MqttProtocolBuilder instance */ clientId(clientId: (session: Session) => string): MqttProtocolBuilder; /** * Clean the MQTT session when closing the MQTT connection * * @param cleanSession - true to clean the session * @returns a new MqttProtocolBuilder instance */ cleanSession(cleanSession: boolean): MqttProtocolBuilder; /** * Define the connect timeout * * @param timeout - the timeout * @returns a new MqttProtocolBuilder instance */ connectTimeout(timeout: Duration): MqttProtocolBuilder; /** * Define the keepAlive timeout * * @param timeout - the keepAlive timeout * @returns a new MqttProtocolBuilder instance */ keepAlive(timeout: Duration): MqttProtocolBuilder; /** * Use an at-most-once QoS * * @returns a new MqttProtocolBuilder instance */ qosAtMostOnce(): MqttProtocolBuilder; /** * Use an at-least-once QoS * * @returns a new MqttProtocolBuilder instance */ qosAtLeastOnce(): MqttProtocolBuilder; /** * Use an exactly-once QoS * * @returns a new MqttProtocolBuilder instance */ qosExactlyOnce(): MqttProtocolBuilder; /** * Instruct the server to retain the message * * @param retain - true to retain * @returns a new MqttProtocolBuilder instance */ retain(retain: boolean): MqttProtocolBuilder; /** * Define the credentials * * @param username - the username, expressed as a Gatling Expression Language String * @param password - the password, expressed as a Gatling Expression Language String * @returns a new MqttProtocolBuilder instance */ credentials(username: string, password: string): MqttProtocolBuilder; /** * Define the credentials * * @param username - the username, expressed as a Gatling Expression Language String * @param password - the password, expressed as a function * @returns a new MqttProtocolBuilder instance */ credentials(username: string, password: (session: Session) => string): MqttProtocolBuilder; /** * Define the credentials * * @param username - the username, expressed as a function * @param password - the password, expressed as a Gatling Expression Language String * @returns a new MqttProtocolBuilder instance */ credentials(username: (session: Session) => string, password: string): MqttProtocolBuilder; /** * Define the credentials * * @param username - the username, expressed as a function * @param password - the password, expressed as a function * @returns a new MqttProtocolBuilder instance */ credentials(username: (session: Session) => string, password: (session: Session) => string): MqttProtocolBuilder; /** * Send a LastWill message when closing the connetion * * @param lw - the last will message * @returns a new MqttProtocolBuilder instance */ lastWill(lw: LastWillBuilder): MqttProtocolBuilder; /** * Define the maximum number of reconnections * * @param reconnectAttemptsMax - the maximum number of reconnections * @returns a new MqttProtocolBuilder instance */ reconnectAttemptsMax(reconnectAttemptsMax: number): MqttProtocolBuilder; /** * Define the reconnect delay exponential backoff multiplier * * @param multiplier - the multiplier * @returns a new MqttProtocolBuilder instance */ reconnectBackoffMultiplier(multiplier: number): MqttProtocolBuilder; /** * Define the delay before reconnecting a crashed connection * * @param delay - the delay * @returns a new MqttProtocolBuilder instance */ reconnectDelay(delay: Duration): MqttProtocolBuilder; /** * Define the resend delay exponential backoff multiplier * * @param multiplier - the multiplier * @returns a new MqttProtocolBuilder instance */ resendBackoffMultiplier(multiplier: number): MqttProtocolBuilder; /** * Define the delay before resending a message * * @param delay - the delay * @returns a new MqttProtocolBuilder instance */ resendDelay(delay: Duration): MqttProtocolBuilder; /** * Define a check to extract the correlationId when applying check that have to match outbound * and inbound messages * * @param correlator - the check to extract the correlationId * @returns a new MqttProtocolBuilder instance */ correlateBy(correlator: CheckBuilder): MqttProtocolBuilder; /** * Define the interval to check for checks timeout * * @param interval - the interval * @returns a new MqttProtocolBuilder instance */ timeoutCheckInterval(interval: Duration): MqttProtocolBuilder; /** * Set the max size of the buffer for unmatched/unchecked inbound WebSocket messages. 0 by * default, meaning such messages are not buffered. * * @param max - the max size * @returns a new MqttProtocolBuilder instance */ unmatchedInboundMessageBufferSize(max: number): MqttProtocolBuilder; } export declare const mqttProtocolBuilder: MqttProtocolBuilder;