STOMP XP-Module

The stomp module is an add-on to the XP framework that adds interoperability packages to talk to STOMP-enabled message queue servers, such as Apache ActiveMQ.

Лицензия

Лицензия

BSD
Категории

Категории

Сеть
Группа

Группа

net.xp-forge
Идентификатор

Идентификатор

stomp
Последняя версия

Последняя версия

6.0.1
Дата

Дата

Тип

Тип

xar
Описание

Описание

STOMP XP-Module
The stomp module is an add-on to the XP framework that adds interoperability packages to talk to STOMP-enabled message queue servers, such as Apache ActiveMQ.
Ссылка на сайт

Ссылка на сайт

https://github.com/xp-forge/stomp
Организация-разработчик

Организация-разработчик

XP-Framework Team
Система контроля версий

Система контроля версий

https://github.com/xp-forge/stomp

Скачать stomp

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
net.xp-framework : core xar 5.9.3

Модули Проекта

Данный проект не имеет модулей.

STOMP protocol implementation

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.0+ Supports PHP 8.0+ Latest Stable Version

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:

  • protocol should be stomp or stomp+ssl
  • host is the hostname to connect
  • port is the port to connect (default: 61613)
  • user, pass can 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
net.xp-forge

XP-Forge

Версии библиотеки

Версия
6.0.1
6.0.0