CakeFest 2024: The Official CakePHP Conference

Stomp::send

stomp_send

(PECL stomp >= 0.1.0)

Stomp::send -- stomp_sendSends a message

Beschreibung

Objektorientierter Stil (method):

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

Prozeduraler Stil:

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

Sends a message to the Message Broker.

Parameter-Liste

link

Nur für prozedurale Aufrufe: Die Stomp-Verbindung, die von stomp_connect() zurückgegeben wurde.

destination

Where to send the message

msg

Message to send.

headers

Assoziatives Array, welches alle zusätzlichen Header beinhaltet (z. B. receipt).

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Beispiele

See stomp_ack().

Anmerkungen

Hinweis:

Ein Transaktionsheader kann angegeben werden. Dies zeigt an, dass die Bestätigung der Nachricht ein Bestandteil der benanten Transaktion sein soll.

Tipp

Eine grundlegende Eigenschaft von Stomp ist die Synchronität. Synchrone Kommunikation kann durch das Hinzufügen eines Empfangsheaders (receipt-Header) implementiert werden. Dies führt dazu, dass Methoden solange nichts zurückgeben, bis der Server den Empfang der Nachricht bestätigt hat oder der Lese-Timeout überschritten wurde.

add a note

User Contributed Notes 1 note

up
-4
james dot mk dot green at gmail dot com
12 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