2024 PHP Conference Japan

Stomp 類別

(PECL stomp >= 0.1.0)

簡介

表示 PHP 與相容 Stomp 的訊息代理程式之間的連線。

類別概要

類別 Stomp {
/* 方法 */
公開 __construct(
    字串 $broker = ini_get("stomp.default_broker_uri"),
    字串(string) $username = ?,
    字串(string) $password = ?,
    陣列(array) $headers = ?
)
公開(public) abort(字串(string) $transaction_id, 陣列(array) $headers = ?): 布林值(bool)
stomp_abort(資源(resource) $link, 字串(string) $transaction_id, 陣列(array) $headers = ?): 布林值(bool)
公開(public) ack(混合型別(mixed) $msg, 陣列(array) $headers = ?): 布林值(bool)
stomp_ack(資源(resource) $link, 混合型別(mixed) $msg, 陣列(array) $headers = ?): 布林值(bool)
公開(public) begin(字串(string) $transaction_id, 陣列(array) $headers = ?): 布林值(bool)
stomp_begin(資源(resource) $link, 字串(string) $transaction_id, 陣列(array) $headers = ?): 布林值(bool)
公開(public) commit(字串(string) $transaction_id, 陣列(array) $headers = ?): 布林值(bool)
stomp_commit(資源(resource) $link, 字串(string) $transaction_id, 陣列(array) $headers = ?): 布林值(bool)
stomp_connect(
    字串 $broker = ini_get("stomp.default_broker_uri"),
    字串(string) $username = ?,
    字串(string) $password = ?,
    陣列(array) $headers = ?
): 資源(resource)
stomp_close(資源(resource) $link): 布林值(bool)
public error(): string
stomp_error(resource $link): 字串
stomp_get_read_timeout(resource $link): 陣列
stomp_get_session_id(resource $link): 字串|false
public hasFrame(): bool
stomp_has_frame(resource $link): 布林值
public readFrame(string $class_name = "stompFrame"): stompframe
stomp_read_frame(resource $link): 陣列
public send(string $destination, mixed $msg, array $headers = ?): bool
stomp_send(
    resource $link,
    string $destination,
    mixed $msg,
    陣列(array) $headers = ?
): 布林值
public setReadTimeout(int $seconds, int $microseconds = ?): void
stomp_set_read_timeout(resource $link, int $seconds, int $microseconds = ?): void
public subscribe(string $destination, array $headers = ?): bool
stomp_subscribe(resource $link, string $destination, array $headers = ?): bool
public unsubscribe(string $destination, array $headers = ?): bool
stomp_unsubscribe(resource $link, string $destination, array $headers = ?): bool
public __destruct()
}

目錄

新增註記

使用者貢獻的註記 1 則註記

guilherme dot geronimo at gmail dot com
7 年前
在某些情況下(例如 ActiveMQ),當您有很多消費者時,您需要在連線過程中識別您的「client-id」,否則伺服器可能會誤解您的連線並建立新的主題/佇列。

<?php
$stomp
= new Stomp($url, $user, $password, array('client-id'=> $clientId ));
?>
To Top