CakeFest 2024: The Official CakePHP Conference

Stomp::send

stomp_send

(PECL stomp >= 0.1.0)

Stomp::send -- stomp_sendSends a message

Descrição

Estilo orientado a objetos (method):

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

Estilo procedural:

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

Sends a message to the Message Broker.

Parâmetros

link

Somente no estilo procedural: O identificador do link stomp retornado por stomp_connect().

destination

Where to send the message

msg

Message to send.

headers

Um array associativo contendo os cabeçalhos adicionais (exemplo: receipt).

Valor Retornado

Retorna true em caso de sucesso ou false em caso de falha.

Exemplos

See stomp_ack().

Notas

Nota:

Um cabeçalho de transação pode ser especificado, indicando que a confirmação da mensagem deve fazer parte da transação nomeada.

Dica

O Stomp é naturalmente assíncrono. Comunicação síncrona pode ser implementada adicionando um cabeçalho receipt. Isso fará com que os métodos não retornem nada até que o servidor confirme o recebimento da mensagem ou até que o tempo limite de leitura seja atingido.

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