2017 © Pedro Peláez
 

library mf4php

This is a facade for messaging systems.

image

mf4php/mf4php

This is a facade for messaging systems.

  • Monday, March 19, 2018
  • by szjani
  • Repository
  • 1 Watchers
  • 4 Stars
  • 21,749 Installations
  • PHP
  • 3 Dependents
  • 2 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

mf4php

This is a messaging facade library. It wraps and hides messaging (event) tools thus you can whenever switch to another one., (*1)

Features

There is one implementation shipped with this package, the MemoryMessageDispatcher. It is useful for synchron communications. There is one asynchronous implementation: mf4php/mf4php-beanstalk, (*2)

Feel free to implement a binding for your preferred event library., (*3)

History

1.1

There is a message dispatcher (abstract) implementation: TransactedMessageDispatcher. It can be used with an ObservableTransactionManager coming from trf4php. Sending messages inside a transaction will be delayed until the transaction is committed. The benefit of this feature is that if a message sending causes error then transaction will be rolled back (buffered messages will be deleted). If the commit is successful, then buffered messages will be delivered and inserted/updated records can be reached in message handlers even if the messages were sent before the commit., (*4)

<?php
/* @var $transactionManager ObservableTransactionManager */
$dispatcher = new TransactedMemoryMessageDispatcher($transactionManager);

/* @var $listener MessageListener */
$dispatcher->addEventListener($queue, $listener);

$transactionManager->beginTransaction();
try {
    // do anything, modify database, etc.
    $dispatcher->send($queue, $message);
    $transactionManager->commit();
    // $message will be delivered to $listener after commit
} catch (Exception $e) {
    $transactionManager->rollback();
    // $message won't be delivered
}

Configuration

<?php
$dispatcher = new MemoryMessageDispatcher();
$queue = new DefaultQueue('queue');

/* @var $listener MessageListener */
$dispatcher->addEventListener($queue, $listener);

Send events

<?php
/* @var $object Serializable */
$message = new ObjectMessage($object);
$dispatcher->send($queue, $message);
// onMessage method in $listener is called

The Versions

19/03 2018

2.0.x-dev

2.0.9999999.9999999-dev

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper messaging facade

19/03 2018

2.0.0

2.0.0.0

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper messaging facade

04/12 2013

1.1.x-dev

1.1.9999999.9999999-dev

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

 

wrapper messaging facade

04/12 2013

dev-master

9999999-dev

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

 

wrapper messaging facade

11/09 2013

1.1.2

1.1.2.0

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

 

wrapper messaging facade

29/12 2012

1.1.1

1.1.1.0

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

 

wrapper messaging facade

27/12 2012

1.1.0

1.1.0.0

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

 

wrapper messaging facade

15/12 2012

1.0.x-dev

1.0.9999999.9999999-dev

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

wrapper messaging facade

15/12 2012

1.0.0

1.0.0.0

This is a facade for messaging systems.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

wrapper messaging facade