@cloudamqp/amqp-client
    Preparing search index...

    Class AMQPRPCClient

    Reusable RPC client using the direct reply-to feature.

    const session = await AMQPSession.connect("amqp://localhost")
    const rpc = await session.rpcClient() // tracked for reconnect recovery
    const reply = await rpc.call("my_queue", "request body")
    console.log(reply.bodyString())
    await rpc.close()
    Index

    Methods

    Methods

    • Perform an RPC call: publish a message and wait for the response.

      Parameters

      • queue: string

        The queue name (routing key) of the RPC server

      • body: Body

        The request body

      • options: AMQPProperties & { timeout?: number } = {}

        Optional properties and timeout

        • Optionaltimeout?: number

          Timeout in milliseconds. Rejects with an error if no response is received within this time.

      Returns Promise<AMQPMessage>

      The reply AMQPMessage

    • Close the dedicated channel, reject any pending calls, and remove this client from the session's reconnect recovery.

      Returns Promise<void>