xp-forge/stomp
最新稳定版本:v12.1.0
Composer 安装命令:
composer require xp-forge/stomp
包简介
STOMP protocol implementation
README 文档
README
About
STOMP is a network protocol to talk to message brokers such as Apache ActiveMQ or RabbitMQ.
The STOMP specification can be found at http://stomp.github.io/.
Examples
Producer
A message producer
use peer\stomp\{Connection, SendableMessage}; $conn= new Connection('stomp://localhost:61613/'); $conn->connect(); $conn->getDestination('/queue/producer')->send( new SendableMessage('Message contents', 'text/plain') );
Consumer
A simple message consumer (subscriber):
use peer\stomp\{Connection, Subscription}; $conn= new Connection('stomp://localhost:61613/'); $conn->connect(); $conn->subscribeTo(new Subscription('/queue/producer', function($message) { Console::writeLine('---> Received message: ', $message); $message->ack(); })); $conn->consume();
Multi-endpoint failover
A consumer with a broker network may connect to any host when available:
use peer\stomp\{Connection, Subscription, Failover}; $nodes= ['stomp://one.example.com:61613/', 'stomp://two.example.com:61613/']; // Connect randomly to one or the other $conn= new Connection(Failover::using($nodes)->byRandom()); $conn->connect(); $conn->subscribeTo(new Subscription('/queue/producer', function($message) { Console::writeLine('---> Received message: ', $message); $message->ack(); })); $conn->consume();
For more examples, please see the examples/ directory.
The connection URL
The URL specifies the options how and where to connect:
protocolshould bestomporstomp+sslhostis the hostname to connectportis the port to connect (default: 61613)user,passcan be given in the URL and will be used for authentication- Supported parameters:
vhost- virtual host name, since STOMP 1.1 (eg.?vhost=example.com)versions- to specify list of supported versions (eg.?versions=1.0,1.1); default is to support 1.0, 1.1
统计信息
- 总下载量: 47.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-01-11

