UNPKG

@gatling.io/mqtt

Version:

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

122 lines (121 loc) 4.28 kB
import { ActionBuilder, Body, CheckBuilder, Duration, Session } from "@gatling.io/core"; export declare namespace PublishActionBuilder { import JvmBase = io.gatling.javaapi.mqtt.PublishActionBuilder$Base; import JvmCheckable = io.gatling.javaapi.mqtt.PublishActionBuilder$Checkable; interface Base { /** * Provide the message to send * * @param body - a body * @returns a new ActionBuilder instance */ message(body: Body): PublishActionBuilder; } interface Checkable extends ActionBuilder { /** * Use an at-most-once QoS * * @returns a new ActionBuilder instance */ qosAtMostOnce(): PublishActionBuilder; /** * Use an at-least-once QoS * * @returns a new ActionBuilder instance */ qosAtLeastOnce(): PublishActionBuilder; /** * Use an exactly-once QoS * * @returns a new ActionBuilder instance */ qosExactlyOnce(): PublishActionBuilder; /** * Apply some checks * * @param checks - the checks * @returns the next DSL step */ check(...checks: Array<CheckBuilder>): PublishActionBuilder.Checkable; } const wrapBase: (_underlying: JvmBase) => PublishActionBuilder.Base; const wrapCheckable: (_underlying: JvmCheckable) => PublishActionBuilder.Checkable; } /** * DSL for actions that publish MQTT messages * * <p>Immutable, so all methods return a new occurrence and leave the original unmodified. */ export interface PublishActionBuilder extends ActionBuilder { /** * Use an at-most-once QoS * * @returns a new ActionBuilder instance */ qosAtMostOnce(): PublishActionBuilder; /** * Use an at-least-once QoS * * @returns a new ActionBuilder instance */ qosAtLeastOnce(): PublishActionBuilder; /** * Use an exactly-once QoS * * @returns a new ActionBuilder instance */ qosExactlyOnce(): PublishActionBuilder; /** * Wait for the checks to complete * * @param timeout - the check timeout * @returns the next DSL step */ await(timeout: Duration): PublishActionBuilder.Checkable; /** * Wait for the checks to complete * * @param timeout - the check timeout * @param expectedTopic - the topic where the response message is expected to be published, * expressed as a Gatling Expression Language String * @returns the next DSL step */ await(timeout: Duration, expectedTopic: string): PublishActionBuilder.Checkable; /** * Wait for the checks to complete * * @param timeout - the check timeout * @param expectedTopic - the topic where the response message is expected to be published, * expressed as a function * @returns the next DSL step */ await(timeout: Duration, expectedTopic: (session: Session) => string): PublishActionBuilder.Checkable; /** * Perform checks in the background, meaning state will have to be reconciled with {@link * MqttDsl#waitForMessages()} * * @param timeout - the check timeout * @returns the next DSL step */ expect(timeout: Duration): PublishActionBuilder.Checkable; /** * Perform checks in the background, meaning state will have to be reconciled with {@link * MqttDsl#waitForMessages()} * * @param timeout - the check timeout * @param expectedTopic - the topic where the response message is expected to be published, * expressed as a Gatling Expression Language String * @returns the next DSL step */ expect(timeout: Duration, expectedTopic: string): PublishActionBuilder.Checkable; /** * Perform checks in the background, meaning state will have to be reconciled with {@link * MqttDsl#waitForMessages()} * * @param timeout - the check timeout * @param expectedTopic - the topic where the response message is expected to be published, * expressed as a function * @returns the next DSL step */ expect(timeout: Duration, expectedTopic: (session: Session) => string): PublishActionBuilder.Checkable; }