PHP 8.5.0 Alpha 2 available for testing

Stomp::send

stomp_send

(PECL stomp >= 0.1.0)

Stomp::send -- stomp_sendEnvía un mensaje

Descripción

Estilo orientado a objetos (método):

public Stomp::send(string $destination, mixed $msg, array $headers = ?): bool

Estilo procedimental:

stomp_send(
    resource $link,
    string $destination,
    mixed $msg,
    array $headers = ?
): bool

Envía un mensaje a el Message Broker.

Parámetros

link

Estilo procedimental únicamente: El identificador stomp devuelto por la funciónstomp_connect().

destination

A dónde eenviar el mensaje

msg

Mensaje a enviar.

headers

Array asociativo que contiene los encabezados adicionales (ejemplo: receipt).

Valores devueltos

Esta función retorna true en caso de éxito o false si ocurre un error.

Ejemplos

Vea stomp_ack().

Notas

Nota:

Un encabezado de transacción puede ser especificado, indicando que la confirmación de los mensajes debe ser parte de la transacción.

Sugerencia

Stomp es, por naturaleza, asíncrono. Una comunicación síncrona puede ser implementada añadiendo un encabezado receipt. Esto hará que los métodos no devuelvan nada hasta que el mensaje de confirmación no haya sido recibido o hasta que el tiempo de espera no sea alcanzado.

add a note

User Contributed Notes 1 note

up
-4
james dot mk dot green at gmail dot com
13 years ago
Without a receipt header your application will fire messages potentially faster than the broker can receive them at. The broker may issue failure notices however STOMP being asynchronous your client won't get to see it.

Without a receipt ActiveMQ (5.5.0) with ProducerFlowControl turned on drops messages (even persistent ones) and my application knows nothing about it (send() returned true). With receipt header specified the STOMP library handles the wait for the receipt acknowledgement for you - you are essentially automatically throttled.
To Top