2017 © Pedro Peláez
 

library amqp-event

Amqp message dispatcher

image

gallna/amqp-event

Amqp message dispatcher

  • Sunday, August 7, 2016
  • by gall_na
  • Repository
  • 1 Watchers
  • 0 Stars
  • 219 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

PHP module

https://github.com/pdezwart/php-amqp, (*1)

Documentation

http://php.net/manual/pl/book.amqp.php, (*2)

Examples

https://github.com/rabbitmq/rabbitmq-tutorials/tree/master/php-amqp, (*3)

Rabit implementation

https://github.com/php-amqplib/php-amqplib/tree/master/demo, (*4)

Dispatch


$envelope = new Amqp\Envelope(); $dispatcher = $amqp->getDispatcher(); // Publish message to queue $dispatcher->dispatch("kernel.error", new Amqp\PublishEvent($envelope)); $dispatcher->dispatch("kernel.warning", new Amqp\PublishEvent($envelope)); // Publish message to exchange $envelope->setExchangeName("exchangeName"); $dispatcher->dispatch("kernel.critical", new Amqp\PublishEvent($envelope)); $dispatcher->dispatch("kernel.notice", new Amqp\PublishEvent($envelope)); $dispatcher->dispatch("kernel.info", new Amqp\PublishEvent($envelope)); $dispatcher->dispatch("kernel.info", new Event()); $dispatcher->dispatch("kernel.message", new Event());

To ensure message delivery to queue/exchange - dispatch MandatoryEvent instead of Event, (*5)

Exception handling

PHP SPL exceptions, (*6)

Logic Exceptions

Logic Exceptions are for errors that occur at compile time. Since PHP has no compile time in the sense this is meant, it usually is interpreted as "errors occuring during development", (like when the developer forgot to pass a depedency or rooting key), (*7)

LogicException are moved to dead-letter exchange because they represents error in the program logic. This kind of exception should lead directly to a fix in code and requeue messages, (*8)

DomainException (a LogicException subset) is thew when naither of listeners consumed the event (either by acknowledging or rejecting message). This can't be fixed otherwise than removing not supported route or adding missing acknowledgement, (*9)

Runtime Exceptions

Runtime Exceptions are for unforseen errors (usually stemming from User Input) when the code is run., (*10)

Those exceptions may be triggered by temporary connection issues, rate limits etc. They are moved automatically to wait exchange to retry them later., (*11)

Throwable

It's up to developer how to handle any other Throwable by wrapping Consumer into try-catch block., (*12)

  • it might be moved to headers exchange - and retried after implementing fix
  • might be moved to dead-letter exchange by message broker
  • rejecting erroring messages with AMQP_REQUEUE flag creates stream of one and the same messages. Keep an eye on retry-count to avoid issues

The Versions

07/08 2016

dev-master

9999999-dev

Amqp message dispatcher

  Sources   Download

The Requires

 

The Development Requires

by Tomasz Jonik

07/08 2016

3.0.2

3.0.2.0

Amqp message dispatcher

  Sources   Download

The Requires

 

The Development Requires

by Tomasz Jonik

07/08 2016

3.0.1

3.0.1.0

Amqp message dispatcher

  Sources   Download

The Requires

 

The Development Requires

by Tomasz Jonik

07/08 2016

3.0.0

3.0.0.0

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

06/08 2016

dev-feature/v3

dev-feature/v3

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

12/07 2016

2.1.0

2.1.0.0

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

11/07 2016

1.0.3

1.0.3.0

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

11/07 2016

2.0.2

2.0.2.0

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

30/06 2016

2.0.1

2.0.1.0

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

30/06 2016

v2.x-dev

2.9999999.9999999.9999999-dev

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

30/06 2016

2.0

2.0.0.0

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

19/05 2016

1.0.2

1.0.2.0

Amqp message dispatcher

  Sources   Download

The Requires

 

by Tomasz Jonik

29/04 2016

1.0.1

1.0.1.0

  Sources   Download

The Requires

 

by Tomasz Jonik

22/04 2016

v0.3

0.3.0.0

  Sources   Download

The Requires

 

by Tomasz Jonik

22/04 2016

1.0

1.0.0.0

  Sources   Download

The Requires

 

by Tomasz Jonik

20/04 2016

v0.2

0.2.0.0

  Sources   Download

The Requires

 

by Tomasz Jonik

19/04 2016

v0.1

0.1.0.0

  Sources   Download

The Requires

 

by Tomasz Jonik