Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: php-enqueue/wamp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.9.0
Choose a base ref
...
head repository: php-enqueue/wamp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Nov 27, 2018

  1. Copy the full SHA
    fe7ff97 View commit details

Commits on Dec 13, 2018

  1. Copy the full SHA
    afe4e49 View commit details

Commits on May 27, 2019

  1. Prefer github pages in packages' readme files

    Paweł Niedzielski committed May 27, 2019
    Copy the full SHA
    0878cd8 View commit details

Commits on Jun 7, 2019

  1. Fix Code Style in all files

    Steveb-p committed Jun 7, 2019
    Copy the full SHA
    06e227f View commit details

Commits on Dec 12, 2019

  1. Reduced dependency to voryx/Thruway

    Mathieu Lemoine committed Dec 12, 2019
    Copy the full SHA
    79e3a84 View commit details

Commits on Dec 19, 2019

  1. master is 0.10

    makasim committed Dec 19, 2019
    Copy the full SHA
    86b1007 View commit details

Commits on Jan 26, 2020

  1. Copy the full SHA
    06903a8 View commit details

Commits on Jul 30, 2020

  1. Copy the full SHA
    c0e8797 View commit details

Commits on Jan 22, 2021

  1. Copy the full SHA
    e9565ca View commit details

Commits on Jan 24, 2021

  1. Copy the full SHA
    70d47c1 View commit details

Commits on Jan 25, 2021

  1. Fix CS

    andrewmy committed Jan 25, 2021
    Copy the full SHA
    318f232 View commit details
  2. Copy the full SHA
    3b7f3a9 View commit details

Commits on Feb 9, 2021

  1. Fix package CI

    - Add push to master trigger;
    - Replace the clunky cache + composer install steps with an Action;
    - Replace Travis with GH WF in packages;
    - Add the missing CI to amqp-tools;
    - Replace the shields.
    andrewmy committed Feb 9, 2021
    Copy the full SHA
    8e384df View commit details
  2. Copy the full SHA
    401fffc View commit details
  3. Copy the full SHA
    988fd80 View commit details

Commits on Feb 17, 2021

  1. Bump some minimal deps

    andrewmy committed Feb 17, 2021
    Copy the full SHA
    2d7ec59 View commit details
  2. More bumps

    andrewmy committed Feb 17, 2021
    Copy the full SHA
    414571a View commit details
  3. Copy the full SHA
    49aacf7 View commit details

Commits on Feb 18, 2021

  1. Fix hanging wamp tests

    andrewmy committed Feb 18, 2021
    Copy the full SHA
    fb11c6c View commit details

Commits on Jul 23, 2021

  1. Copy the full SHA
    8070e70 View commit details
  2. Copy the full SHA
    c5aee1d View commit details

Commits on Feb 26, 2023

  1. Fix Shield URLs in READMEs

    amayer5125 committed Feb 26, 2023
    Copy the full SHA
    63a750e View commit details

Commits on Mar 20, 2023

  1. Copy the full SHA
    3315d9f View commit details

Commits on Mar 23, 2023

  1. Copy the full SHA
    689d132 View commit details

Commits on Jan 11, 2025

  1. Fixing risky tests

    Makring tests that have no assertions with the annotation to suppress
    phpunits warning around risky tests
    
    closes 1370
    JimTools committed Jan 11, 2025
    Copy the full SHA
    ed0b009 View commit details

Commits on Jan 15, 2025

  1. Removing constructor tests

    Removing all tests that creates a new instance but doesn't call any
    methods nor preform any assertions.
    JimTools committed Jan 15, 2025
    Copy the full SHA
    c53a498 View commit details

Commits on Jan 17, 2025

  1. Running php-cs-fixer

    Running php-cs-fixer to fix CS drift
    JimTools committed Jan 17, 2025
    Copy the full SHA
    88accf9 View commit details

Commits on Apr 27, 2025

  1. Updating composer

    Updating composer.json in pkg directory to correctly reflect the
    supported versions of PHP
    JimTools committed Apr 27, 2025
    Copy the full SHA
    3cf642c View commit details
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI
on:
pull_request:
push:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2']

name: PHP ${{ matrix.php }} tests

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- uses: "ramsey/composer-install@v1"

- run: vendor/bin/phpunit --exclude-group=functional
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

16 changes: 4 additions & 12 deletions JsonSerializer.php
Original file line number Diff line number Diff line change
@@ -14,12 +14,8 @@ public function toString(WampMessage $message): string
'headers' => $message->getHeaders(),
]);

if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(sprintf(
'The malformed json given. Error %s and message %s',
json_last_error(),
json_last_error_msg()
));
if (\JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
}

return $json;
@@ -28,12 +24,8 @@ public function toString(WampMessage $message): string
public function toMessage(string $string): WampMessage
{
$data = json_decode($string, true);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(sprintf(
'The malformed json given. Error %s and message %s',
json_last_error(),
json_last_error_msg()
));
if (\JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
}

return new WampMessage($data['body'], $data['properties'], $data['headers']);
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,27 +10,27 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
# Web Application Messaging Protocol (WAMP) Transport

[![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby)
[![Build Status](https://travis-ci.org/php-enqueue/wamp.png?branch=master)](https://travis-ci.org/php-enqueue/wamp)
[![Build Status](https://img.shields.io/github/actions/workflow/status/php-enqueue/wamp/ci.yml?branch=master)](https://github.com/php-enqueue/wamp/actions?query=workflow%3ACI)
[![Total Downloads](https://poser.pugx.org/enqueue/wamp/d/total.png)](https://packagist.org/packages/enqueue/wamp)
[![Latest Stable Version](https://poser.pugx.org/enqueue/wamp/version.png)](https://packagist.org/packages/enqueue/wamp)
This is an implementation of [queue interop](https://github.com/queue-interop/queue-interop). It uses [Thruway](https://github.com/voryx/Thruway) internally.

This is an implementation of [queue interop](https://github.com/queue-interop/queue-interop). It uses [Thruway](https://github.com/thruway/client) internally.

## Resources

* [Site](https://enqueue.forma-pro.com/)
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
* [Documentation](https://php-enqueue.github.io/transport/wamp/)
* [Questions](https://gitter.im/php-enqueue/Lobby)
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

## Developed by Forma-Pro

Forma-Pro is a full stack development company which interests also spread to open source development.
Being a team of strong professionals we have an aim an ability to help community by developing cutting edge solutions in the areas of e-commerce, docker & microservice oriented architecture where we have accumulated a huge many-years experience.
Forma-Pro is a full stack development company which interests also spread to open source development.
Being a team of strong professionals we have an aim an ability to help community by developing cutting edge solutions in the areas of e-commerce, docker & microservice oriented architecture where we have accumulated a huge many-years experience.
Our main specialization is Symfony framework based solution, but we are always looking to the technologies that allow us to do our job the best way. We are committed to creating solutions that revolutionize the way how things are developed in aspects of architecture & scalability.

If you have any questions and inquires about our open source development, this product particularly or any other matter feel free to contact at opensource@forma-pro.com

## License

It is released under the [MIT License](LICENSE).
It is released under the [MIT License](LICENSE).
3 changes: 0 additions & 3 deletions SerializerAwareTrait.php
Original file line number Diff line number Diff line change
@@ -11,9 +11,6 @@ trait SerializerAwareTrait
*/
private $serializer;

/**
* @param Serializer $serializer
*/
public function setSerializer(Serializer $serializer)
{
$this->serializer = $serializer;
5 changes: 3 additions & 2 deletions Tests/Functional/WampConsumerTest.php
Original file line number Diff line number Diff line change
@@ -12,14 +12,15 @@
/**
* @group functional
* @group Wamp
*
* @retry 5
*/
class WampConsumerTest extends TestCase
{
use WampExtension;
use RetryTrait;
use WampExtension;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
Logger::set(new NullLogger());
}
2 changes: 1 addition & 1 deletion Tests/Functional/WampSubscriptionConsumerTest.php
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ class WampSubscriptionConsumerTest extends TestCase
{
use WampExtension;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
Logger::set(new NullLogger());
}
11 changes: 3 additions & 8 deletions Tests/Spec/JsonSerializerTest.php
Original file line number Diff line number Diff line change
@@ -20,11 +20,6 @@ public function testShouldImplementSerializerInterface()
$this->assertClassImplements(Serializer::class, JsonSerializer::class);
}

public function testCouldBeConstructedWithoutAnyArguments()
{
new JsonSerializer();
}

public function testShouldConvertMessageToJsonString()
{
$serializer = new JsonSerializer();
@@ -40,10 +35,10 @@ public function testThrowIfFailedToEncodeMessageToJson()
{
$serializer = new JsonSerializer();

$resource = fopen(__FILE__, 'rb');
$resource = fopen(__FILE__, 'r');

//guard
$this->assertInternalType('resource', $resource);
// guard
$this->assertIsResource($resource);

$message = new WampMessage('theBody', ['aProp' => $resource]);

3 changes: 0 additions & 3 deletions Tests/Spec/WampConnectionFactoryTest.php
Original file line number Diff line number Diff line change
@@ -10,9 +10,6 @@
*/
class WampConnectionFactoryTest extends ConnectionFactorySpec
{
/**
* {@inheritdoc}
*/
protected function createConnectionFactory()
{
return new WampConnectionFactory();
3 changes: 0 additions & 3 deletions Tests/Spec/WampContextTest.php
Original file line number Diff line number Diff line change
@@ -13,9 +13,6 @@ class WampContextTest extends ContextSpec
{
use WampExtension;

/**
* {@inheritdoc}
*/
protected function createContext()
{
return $this->buildWampContext();
3 changes: 0 additions & 3 deletions Tests/Spec/WampMessageTest.php
Original file line number Diff line number Diff line change
@@ -10,9 +10,6 @@
*/
class WampMessageTest extends MessageSpec
{
/**
* {@inheritdoc}
*/
protected function createMessage()
{
return new WampMessage();
3 changes: 0 additions & 3 deletions Tests/Spec/WampProducerTest.php
Original file line number Diff line number Diff line change
@@ -13,9 +13,6 @@ class WampProducerTest extends ProducerSpec
{
use WampExtension;

/**
* {@inheritdoc}
*/
protected function createProducer()
{
return $this->buildWampContext()->createProducer();
3 changes: 0 additions & 3 deletions Tests/Spec/WampQueueTest.php
Original file line number Diff line number Diff line change
@@ -10,9 +10,6 @@
*/
class WampQueueTest extends QueueSpec
{
/**
* {@inheritdoc}
*/
protected function createQueue()
{
return new WampDestination(self::EXPECTED_QUEUE_NAME);
3 changes: 0 additions & 3 deletions Tests/Spec/WampTopicTest.php
Original file line number Diff line number Diff line change
@@ -10,9 +10,6 @@
*/
class WampTopicTest extends TopicSpec
{
/**
* {@inheritdoc}
*/
protected function createTopic()
{
return new WampDestination(self::EXPECTED_TOPIC_NAME);
5 changes: 1 addition & 4 deletions WampConnectionFactory.php
Original file line number Diff line number Diff line change
@@ -88,10 +88,7 @@ private function parseDsn(string $dsn): array
$dsn = Dsn::parseFirst($dsn);

if (false === in_array($dsn->getSchemeProtocol(), ['wamp', 'ws'], true)) {
throw new \LogicException(sprintf(
'The given scheme protocol "%s" is not supported. It must be "wamp"',
$dsn->getSchemeProtocol()
));
throw new \LogicException(sprintf('The given scheme protocol "%s" is not supported. It must be "wamp"', $dsn->getSchemeProtocol()));
}

return array_filter(array_replace($dsn->getQuery(), [
6 changes: 1 addition & 5 deletions WampConsumer.php
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ public function receive(int $timeout = 0): ?Message
}

if ($timeout > 0) {
$timeout = $timeout / 1000;
$timeout /= 1000;
$timeout = $timeout >= 0.1 ? $timeout : 0.1;

$this->timer = $this->client->getLoop()->addTimer($timeout, function () {
@@ -112,8 +112,6 @@ public function receiveNoWait(): ?Message
}

/**
* {@inheritdoc}
*
* @param WampMessage $message
*/
public function acknowledge(Message $message): void
@@ -122,8 +120,6 @@ public function acknowledge(Message $message): void
}

/**
* {@inheritdoc}
*
* @param WampMessage $message
*/
public function reject(Message $message, bool $requeue = false): void
6 changes: 1 addition & 5 deletions WampContext.php
Original file line number Diff line number Diff line change
@@ -97,11 +97,7 @@ public function getNewClient(): Client
$client = call_user_func($this->clientFactory);

if (false == $client instanceof Client) {
throw new \LogicException(sprintf(
'The factory must return instance of "%s". But it returns %s',
Client::class,
is_object($client) ? get_class($client) : gettype($client)
));
throw new \LogicException(sprintf('The factory must return instance of "%s". But it returns %s', Client::class, is_object($client) ? $client::class : gettype($client)));
}

$this->clients[] = $client;
14 changes: 3 additions & 11 deletions WampProducer.php
Original file line number Diff line number Diff line change
@@ -48,8 +48,6 @@ public function __construct(WampContext $context)
}

/**
* {@inheritdoc}
*
* @param WampDestination $destination
* @param WampMessage $message
*/
@@ -113,11 +111,9 @@ public function send(Destination $destination, Message $message): void
}

/**
* {@inheritdoc}
*
* @return WampProducer
*/
public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
if (null === $deliveryDelay) {
return $this;
@@ -132,11 +128,9 @@ public function getDeliveryDelay(): ?int
}

/**
* {@inheritdoc}
*
* @return WampProducer
*/
public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
if (null === $priority) {
return $this;
@@ -151,11 +145,9 @@ public function getPriority(): ?int
}

/**
* {@inheritdoc}
*
* @return WampProducer
*/
public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
if (null === $timeToLive) {
return $this;
10 changes: 3 additions & 7 deletions WampSubscriptionConsumer.php
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ public function consume(int $timeout = 0): void
}

if ($timeout > 0) {
$timeout = $timeout / 1000;
$timeout /= 1000;
$timeout = $timeout >= 0.1 ? $timeout : 0.1;

$this->timer = $this->client->getLoop()->addTimer($timeout, function () {
@@ -100,14 +100,12 @@ public function consume(int $timeout = 0): void
}

/**
* {@inheritdoc}
*
* @param WampConsumer $consumer
*/
public function subscribe(Consumer $consumer, callable $callback): void
{
if (false == $consumer instanceof WampConsumer) {
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', WampConsumer::class, get_class($consumer)));
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', WampConsumer::class, $consumer::class));
}

if ($this->client) {
@@ -127,14 +125,12 @@ public function subscribe(Consumer $consumer, callable $callback): void
}

/**
* {@inheritdoc}
*
* @param WampConsumer $consumer
*/
public function unsubscribe(Consumer $consumer): void
{
if (false == $consumer instanceof WampConsumer) {
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', WampConsumer::class, get_class($consumer)));
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', WampConsumer::class, $consumer::class));
}

if ($this->client) {
29 changes: 18 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -6,17 +6,21 @@
"homepage": "https://enqueue.forma-pro.com/",
"license": "MIT",
"require": {
"php": "^7.1.3",
"queue-interop/queue-interop": "^0.7",
"enqueue/dsn": "0.9.x-dev",
"thruway/pawl-transport": "^0.5.0",
"voryx/thruway": "^0.5.3"
"php": "^8.1",
"queue-interop/queue-interop": "^0.8.1",
"enqueue/dsn": "^0.10.8",
"thruway/client": "^0.5.5",
"thruway/pawl-transport": "^0.5.1",
"voryx/thruway-common": "^1.0.1",
"react/dns": "^1.4",
"react/event-loop": "^1.2",
"react/promise": "^2.8"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0",
"enqueue/test": "0.9.x-dev",
"enqueue/null": "0.9.x-dev",
"queue-interop/queue-spec": "^0.6"
"phpunit/phpunit": "^9.5",
"enqueue/test": "0.10.x-dev",
"enqueue/null": "0.10.x-dev",
"queue-interop/queue-spec": "^0.6.2"
},
"support": {
"email": "opensource@forma-pro.com",
@@ -31,10 +35,13 @@
"/Tests/"
]
},
"minimum-stability": "dev",
"minimum-stability": "beta",
"extra": {
"branch-alias": {
"dev-master": "0.9.x-dev"
"dev-master": "0.10.x-dev"
}
},
"config": {
"prefer-stable": true
}
}
17 changes: 6 additions & 11 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./vendor/autoload.php"
>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd"
colors="true"
bootstrap="./vendor/autoload.php"
>

<testsuites>
<testsuite name="Message Queue WAMP Transport Test Suite">