Dutch PHP Conference 2025 - Call For Papers

Stomp::send

stomp_send

(PECL stomp >= 0.1.0)

Stomp::send -- stomp_sendSends a message

Опис

Об'єктно-орієнтований стиль (method):

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

Процедурний стиль:

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

Sends a message to the Message Broker.

Параметри

link

Тільки процедурний стиль: Ідентифікатор з'єднання Stomp, якого повертає функція stomp_connect().

destination

Where to send the message

msg

Message to send.

headers

Асоціативний масив, що містить додаткові заголовки (наприклад: "receipt").

Значення, що повертаються

Повертає true у разі успіху або false в разі помилки.

Приклади

See stomp_ack().

Примітки

Зауваження:

Можна вказати заголовок транзакції, який сигналізує, що підтвердження повідомлення має бути частиною названої транзакції.

Підказка

Stomp за своєю суттю є асинхронним. Синхронні з'єднання можна встановлювати, додавши заголовок "receipt". Це призведе до того, що методи нічого не повертатимуть, доки сервер не підтвердить отримання повідомлення або доки не мине час очікування читання.

add a note

User Contributed Notes 1 note

up
-3
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