2017 © Pedro Peláez
 

library nsq-swoole

PHP client for NSQ with Swoole

image

asan/nsq-swoole

PHP client for NSQ with Swoole

  • Wednesday, June 28, 2017
  • by Janson-Leung
  • Repository
  • 1 Watchers
  • 9 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

NSQ-SWOOLE

PHP Swoole client for NSQ., (*1)

Requirements

  • PHP 5.4 or higher
  • Swoole 1.8.6 or higher

Installation

composer require asan/nsq-swoole

Testing it out

Publish:, (*2)

php tests/PublishTest.php

Subscribe:, (*3)

php tests/SubscribeTest.php

Publishing

The client supports publishing to N nsqd servers. which must be specified explicitly by hostname. And supports publishing multiple messages., (*4)

$client = new Asan\Nsq\Client;

$client->publishTo([
    ['host' => 'localhost', 'port' => 4150]
])->publish('test', 'single message');

//multiple messages
$client->publish('test', ['message one', 'message two']);

//HA publishing:
$client->publishTo([
    ['host' => 'nsq1', 'port' => 4150],
    ['host' => 'nsq2', /*'port' => 4150*/]
], Asan\Nsq\Client::PUB_QUORUM)->publish('test', 'HA publishing message');

Subscribing

The client supports subscribing from N nsqd servers, each of which will be auto-discovered from one or more nslookupd servers. The way this works is that nslookupd is able to provide a list of auto-discovered nodes hosting messages for a given topic., (*5)

$lookup = new Asan\Nsq\Lookup\Lookupd([
    ['host' => 'nsq1', 'port' => 4161],
    ['host' => 'nsq2', /*'port' => 4161*/]
]);

$client = new Asan\Nsq\Client;

$client->subscribe($lookup, 'test', 'web', function($moniter, $msg) {
    echo sprintf("READ\t%s\t%s\n", $msg->getId(), $msg->getPayload());
});

The Versions

28/06 2017

dev-master

9999999-dev https://github.com/Janson-Leung/nsq-swoole

PHP client for NSQ with Swoole

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-swoole >=1.8.6

 

28/06 2017

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/Janson-Leung/nsq-swoole

PHP client for NSQ with Swoole

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-swoole >=1.8.6

 

27/06 2017

v1.3

1.3.0.0 https://github.com/Janson-Leung/nsq-swoole

PHP client for NSQ with Swoole

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-swoole >=1.8.6

 

08/06 2017

v1.2

1.2.0.0 https://github.com/Janson-Leung/nsq-swoole

PHP client for NSQ with Swoole

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-swoole >=1.8.6

 

07/06 2017

v1.1

1.1.0.0 https://github.com/Janson-Leung/nsq-swoole

PHP client for NSQ with Swoole

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-swoole >=1.8.6

 

02/06 2017

v1.0

1.0.0.0 https://github.com/Janson-Leung/nsq-swoole

PHP client for NSQ with Swoole

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-swoole >=1.8.6