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

    Class AMQPRPCClient<P, C, KP, KC>

    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()

    Type Parameters

    • P extends ParserMap = {}
    • C extends CoderMap = {}
    • KP extends keyof P & string = never
    • KC extends keyof C & string = never
    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: ResolveBody<P, KP>

        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<P>>

      The reply AMQPMessage

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

      Returns Promise<void>