@gatling.io/mqtt
Version:
Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).
88 lines (87 loc) • 3.33 kB
TypeScript
import { ActionBuilder, Expression, Session } from "@gatling.io/core";
import { ConnectActionBuilder } from "./connect";
import { MqttInboundMessage } from "./message";
import { MqttProtocolBuilder } from "./protocol";
import { PublishActionBuilder } from "./publish";
import { SubscribeActionBuilder } from "./subscribe";
import { WaitForMessagesActionBuilder } from "./wait";
export * from "./connect";
export * from "./lastWill";
export * from "./message";
export * from "./protocol";
export * from "./publish";
export * from "./subscribe";
export * from "./wait";
export declare namespace Mqtt {
interface Apply {
/**
* Boostrap a builder for a MQTT action
*
* @param name - the action name, expressed as a Gatling Expression Language String
* @returns the next DSL step
*/
(name: string): MqttBuilder;
/**
* Boostrap a builder for a MQTT action
*
* @param name - the action name, expressed as a function
* @returns the next DSL step
*/
(name: (session: Session) => string): MqttBuilder;
}
const apply: (name: Expression<string>) => MqttBuilder;
interface Prefix {
/**
* Boostrap a builder for an action that waits for all awaited inbound messages to arrive
*
* @returns the next DSL step
*/
waitForMessages(): WaitForMessagesActionBuilder;
/**
* Process the currently buffered inbound MQTT messages and empty the buffer
*
* @param topic - the name of the topic, expressed as a Gatling Expression Language String
* @param f - the function to process the buffered messages
* @returns an ActionBuilder
*/
processUnmatchedMessages(topic: string, f: (messages: Array<MqttInboundMessage>, session: Session) => Session): ActionBuilder;
}
const prefix: Prefix;
}
export interface MqttBuilder {
/**
* Create a builder for actions that create a MQTT connection
*
* @returns a new ActionBuilder instance
*/
connect(): ConnectActionBuilder;
/**
* Create a builder for actions that subscribe to a MQTT topic
*
* @param topic - the name of the topic, expressed as a Gatling Expression Language String
* @returns a new ActionBuilder instance
*/
subscribe(topic: string): SubscribeActionBuilder;
/**
* Create a builder for actions that subscribe to a MQTT topic
*
* @param topic - the name of the topic, expressed as a function
* @returns a new ActionBuilder instance
*/
subscribe(topic: (session: Session) => string): SubscribeActionBuilder;
/**
* Create a builder for actions that publish to a MQTT topic
*
* @param topic - the name of the topic, expressed as a Gatling Expression Language String
* @returns a new ActionBuilder instance
*/
publish(topic: string): PublishActionBuilder.Base;
/**
* Create a builder for actions that publish to a MQTT topic
*
* @param topic - the name of the topic, expressed as a function
* @returns a new ActionBuilder instance
*/
publish(topic: (session: Session) => string): PublishActionBuilder.Base;
}
export declare const mqtt: Mqtt.Apply & Mqtt.Prefix & MqttProtocolBuilder;