$ composer require enqueue/stomp
<?php
use Enqueue\Stomp\StompConnectionFactory;
$connectionFactory = new StompConnectionFactory([
'host' => '127.0.0.1',
'port' => 61613,
'login' => 'guest',
'password' => 'guest',
'vhost' => '/',
]);
$psrContext = $connectionFactory->createContext();
<?php
/** @var \Enqueue\Stomp\StompContext $psrContext */
$message = $psrContext->createMessage('Hello world!');
$fooTopic = $psrContext->createTopic('foo');
$psrContext->createProducer()->send($fooTopic, $message);
<?php
/** @var \Enqueue\Stomp\StompContext $psrContext */
$message = $psrContext->createMessage('Hello world!');
$fooQueue = $psrContext->createQueue('foo');
$psrContext->createProducer()->send($fooQueue, $message);
<?php
/** @var \Enqueue\Stomp\StompContext $psrContext */
$fooQueue = $psrContext->createQueue('foo');
$consumer = $psrContext->createConsumer($fooQueue);
$message = $consumer->receive();
// process a message
$consumer->acknowledge($message);
// $consumer->reject($message);
back to index