Nachricht is an message dispatcher which focuses on distributing workloads

Overview

Testing

Nachricht

Nachricht is a message dispatcher which focuses on distributing workloads.

Features

  • Directly dispatch messages
  • Dispatch messages via AMQP
  • auto-discovery to find and create AMQP Messages queues
  • dead-lettering mechanism

Requirements

A PSR-11 compatible container (we recommend the Symfony DependencyInjection component) is required. The instances of listeners will be obtained from the container via $container->get($listenerClass).

The RabbitMQ delayed message exchange plugin may be installed before using Nachricht to make sure you can work with message delay.

Usage

Create an message class by implementing JTL\Nachricht\Contract\Message\Message.

use JTL\Nachricht\Contract\Message\Message;

class DummyMessage implements Message
{
    private string $data;

    public function __construct(string $data)
    {
        $this->data = $data;
    }

    public function getData(): string
    {
        return $this->data;
    }
}

Create a listener class by implementing JTL\Nachricht\Contract\Listener\Listener

use JTL\Nachricht\Contract\Listener\Listener;

class DummyListener implements Listener
{
    public function listen(DummyMessage $event): void
    {
        echo 'Dummy Listener called: ' . $event->getData() . "\n";
    }
}

Emit the Event

$emitter = $container->get(DirectEmitter::class);

$event = new FooMessage('Test');

$emitter->emit($event); 

Output

# php examples/DirectEmit/DirectEmit.php
FooListener called: Test 

Emit delayed messages

A delay can be used to make a message invisible for the consumer until a defined time is reached. There are two types of delay available

On message construct: delay a message when it is getting emitted. You can specify such a delay (in seconds) when constructing a new message instance.

$event = new DelayedDummyAmqpMessage(data: 'Test', delay: 3);
$emitter->emit($event); 

To specify a retry delay overwrite method getRetryDelay(): int method (default retry delay is set to 3 seconds). Such delay will be used every time a Listener facing an Error when cause jtl/nachricht to re-queue the message

You can find more examples in the example directory.

You might also like...
Composer package which adds support for HTML5 elements using Laravels Form interface (e.g. Form::date())

Laravel HTML 5 Inputs Composer package which adds support for HTML5 elements by extending Laravel's Form interface (e.g. Form::date()) Adds support fo

Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.
Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Github repository dedicated for my YT tutorial which shows how to use testing in Laravel

Testing in Laravel The following documentation is based on my Laravel Testing for Beginners tutorial we’re going to cover the basics of unit tests, fe

Is an Extension of Laravel View Class which compiles String Template on the fly. It automatically detects changes on your string template and recompiles it if needed.

Laravel-fly-view Is an Extension of Laravel View Class which compiles String Template on the fly. It automatically detects changes on your string temp

Package to optimize your site automatically which results in a 35%+ optimization
Package to optimize your site automatically which results in a 35%+ optimization

Laravel Page Speed Simple package to minify HTML output on demand which results in a 35%+ optimization. Laravel Page Speed was created by Renato Marin

GeoLocation-Package - This package helps you to know the current language of the user, the country from which he is browsing, the currency of his country, and also whether he is using it vpn
GeoLocation-Package - This package helps you to know the current language of the user, the country from which he is browsing, the currency of his country, and also whether he is using it vpn

GeoLocation in PHP (API) 😍 😍 😍 This package helps you to know a lot of information about the current user by his ip address 😍 😍 😍 This package h

A site which you can apply jobs or search for employees with cool functionalities..
A site which you can apply jobs or search for employees with cool functionalities..

About App An App which you can apply jobs or search for employees with cool functionalities. Some Pics of App Click Image to Zoom in Sign In & Up Empl

Flexihash is a small PHP library which implements consistent hashing.

Flexihash Flexihash is a small PHP library which implements consistent hashing, which is most useful in distributed caching. It requires PHP5 and uses

A program which shows the match days and results of a sport league developed with HTML, PHP and BladeOne technology

league-table Escribe un programa PHP que permita al usuario introducir los nombres de los equipos que participan un una liga de fΓΊtbol. Con dichos nom

Comments
  • Bump phpseclib/phpseclib from 2.0.23 to 2.0.33 in /examples

    Bump phpseclib/phpseclib from 2.0.23 to 2.0.33 in /examples

    Bumps phpseclib/phpseclib from 2.0.23 to 2.0.33.

    Release notes

    Sourced from phpseclib/phpseclib's releases.

    2.0.33

    • SFTP: don't check SFTP packet size after SFTP initialization (#1606)
    • SFTP: timeout during SFTP init should return false (#1684)
    • SFTP: return false if get_channel_packet returns false (#1678)
    • ASN1: return false when not enough bytes are available (#1676)

    2.0.32

    • SSH2: add getAuthMethodsToContinue() method (#1648)
    • SSH2: timeout would occasionally infinitely loop
    • SSH2: fix PHP7.4 errors about accessing bool as string (#1656)
    • SSH2: fix issue with key re-exchange (#1644)
    • SFTP: reopen channel on channel closure (#1654)
    • X509: extra characters before cert weren't being removed (#1659)
    • ASN1: fix timezone issue when non-utc time is given (#1562)
    • RSA: OAEP decryption didn't check labels correctly (#1669)

    2.0.31

    • X509: always parse the first cert of a bundle (#1568)
    • SSH2: behave like putty with broken publickey auth (#1572)
    • SSH2: don't close channel on unexpected response to channel request (#1631)
    • RSA: support keys with PSS algorithm identifier (#1584)
    • RSA: cleanup RSA PKCS#1 v1.5 signature verification (CVE-2021-30130)
    • SFTP/Stream: make it so you can write past the end of a file (#1618)
    • SFTP: fix undefined index notice in stream touch() (#1615)
    • SFTP: digit only filenames were converted to integers by php (#1623)
    • BigInteger: fix issue with toBits on 32-bit PHP 8 installs
    • Crypt: use a custom error handler for mcrypt to avoid deprecation errors

    2.0.30

    • X509: don't attempt to parse multi-cert PEMs (#1542)
    • SFTP: add stream to get method (#1546)
    • SFTP: progress callback should report actual downloaded bytes (#1543)
    • SSH2: end connection faster for algorithm mismatch
    • SSH2: add setKeepAlive() method (#1529)
    • ANSI: fix PHP8 compatibility issues

    Download PHP Secure Communications Library

    2.0.29

    • SFTP: add enableDatePreservation() / disableDatePreservation() (#1496)
    • SFTP: uploads on low speed networks could get in infinite loop (#1507)
    • SSH2: when building algo list look at if crypto engine is set (#1500)
    • X509: really looong base64 encoded strings broke extractBER() (#1486)

    Download PHP Secure Communications Library

    2.0.28

    • SFTP: realpath('') produced an error (#1474)
    • SFTP: if /path/to/file is a file then /path/to/file/whatever errors (#1475)
    • SFTP: speed up uploads (by changing SFTP upload packet size from 4KB to 32KB)

    ... (truncated)

    Changelog

    Sourced from phpseclib/phpseclib's changelog.

    2.0.33 - 2021-08-15

    • SFTP: don't check SFTP packet size after SFTP initialization (#1606)
    • SFTP: timeout during SFTP init should return false (#1684)
    • SFTP: return false if get_channel_packet returns false (#1678)
    • ASN1: return false when not enough bytes are available (#1676)

    2.0.32 - 2021-06-13

    • SSH2: add getAuthMethodsToContinue() method (#1648)
    • SSH2: timeout would occasionally infinitely loop
    • SSH2: fix PHP7.4 errors about accessing bool as string (#1656)
    • SSH2: fix issue with key re-exchange (#1644)
    • SFTP: reopen channel on channel closure (#1654)
    • X509: extra characters before cert weren't being removed (#1659)
    • ASN1: fix timezone issue when non-utc time is given (#1562)
    • RSA: OAEP decryption didn't check labels correctly (#1669)

    2.0.31 - 2021-04-06

    • X509: always parse the first cert of a bundle (#1568)
    • SSH2: behave like putty with broken publickey auth (#1572)
    • SSH2: don't close channel on unexpected response to channel request (#1631)
    • RSA: support keys with PSS algorithm identifier (#1584)
    • RSA: cleanup RSA PKCS#1 v1.5 signature verification (CVE-2021-30130)
    • SFTP/Stream: make it so you can write past the end of a file (#1618)
    • SFTP: fix undefined index notice in stream touch() (#1615)
    • SFTP: digit only filenames were converted to integers by php (#1623)
    • BigInteger: fix issue with toBits on 32-bit PHP 8 installs
    • Crypt: use a custom error handler for mcrypt to avoid deprecation errors

    2.0.30 - 2020-12-16

    • X509: don't attempt to parse multi-cert PEMs (#1542)
    • SFTP: add stream to get method (#1546)
    • SFTP: progress callback should report actual downloaded bytes (#1543)
    • SSH2: end connection faster for algorithm mismatch
    • SSH2: add setKeepAlive() method (#1529)
    • ANSI: fix PHP8 compatibility issues

    2.0.29 - 2020-09-07

    • SFTP: add enableDatePreservation() / disableDatePreservation() (#1496)
    • SFTP: uploads on low speed networks could get in infinite loop (#1507)
    • SSH2: when building algo list look at if crypto engine is set (#1500)
    • X509: really looong base64 encoded strings broke extractBER() (#1486)

    2.0.28 - 2020-07-08

    • SFTP: realpath('') produced an error (#1474)

    ... (truncated)

    Commits
    • fb53b78 CHANGELOG: add 2.0.33 release
    • c08afba Merge branch '1.0' into 2.0
    • 0ec9d2b SFTP: CS adjustments
    • b0fe99b Merge branch '1.0' into 2.0
    • dab514f timeout in _get_channel_packet during _init_sftp_connection should be a failure
    • 6b0f0b4 Merge branch '1.0' into 2.0
    • a02526e SFTP: return false if get_channel_packet returns false
    • 01addfb Tests/X509: update new unit test to work with 2.0
    • 5a3e622 Merge branch '1.0' into 2.0
    • 973bb07 ASN1: return false when not enough bytes are available
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump phpseclib/phpseclib from 2.0.23 to 2.0.31 in /examples

    Bump phpseclib/phpseclib from 2.0.23 to 2.0.31 in /examples

    Bumps phpseclib/phpseclib from 2.0.23 to 2.0.31.

    Release notes

    Sourced from phpseclib/phpseclib's releases.

    2.0.31

    • X509: always parse the first cert of a bundle (#1568)
    • SSH2: behave like putty with broken publickey auth (#1572)
    • SSH2: don't close channel on unexpected response to channel request (#1631)
    • RSA: support keys with PSS algorithm identifier (#1584)
    • RSA: cleanup RSA PKCS#1 v1.5 signature verification (CVE-2021-30130)
    • SFTP/Stream: make it so you can write past the end of a file (#1618)
    • SFTP: fix undefined index notice in stream touch() (#1615)
    • SFTP: digit only filenames were converted to integers by php (#1623)
    • BigInteger: fix issue with toBits on 32-bit PHP 8 installs
    • Crypt: use a custom error handler for mcrypt to avoid deprecation errors

    2.0.30

    • X509: don't attempt to parse multi-cert PEMs (#1542)
    • SFTP: add stream to get method (#1546)
    • SFTP: progress callback should report actual downloaded bytes (#1543)
    • SSH2: end connection faster for algorithm mismatch
    • SSH2: add setKeepAlive() method (#1529)
    • ANSI: fix PHP8 compatibility issues

    Download PHP Secure Communications Library

    2.0.29

    • SFTP: add enableDatePreservation() / disableDatePreservation() (#1496)
    • SFTP: uploads on low speed networks could get in infinite loop (#1507)
    • SSH2: when building algo list look at if crypto engine is set (#1500)
    • X509: really looong base64 encoded strings broke extractBER() (#1486)

    Download PHP Secure Communications Library

    2.0.28

    • SFTP: realpath('') produced an error (#1474)
    • SFTP: if /path/to/file is a file then /path/to/file/whatever errors (#1475)
    • SFTP: speed up uploads (by changing SFTP upload packet size from 4KB to 32KB)
    • ANSI: fix "Number of elements can't be negative" error

    2.0.27

    • SFTP: change the mode with a SETSTAT instead of MKDIR (#1463)
    • SFTP: make it so extending SFTP class doesn't cause a segfault (#1465)
    • Random::string didn't always return all the requested bytes (#1466)

    2.0.26

    • SFTP: another attempt at speeding up uploads (#1455)
    • SSH2: try logging in with none as an auth method first (#1454)
    • ASN1: fix for malformed ASN1 strings (#1456)

    2.0.25

    • SFTP: re-add buffering (#1455)

    2.0.24

    ... (truncated)

    Changelog

    Sourced from phpseclib/phpseclib's changelog.

    2.0.31 - 2021-04-06

    • X509: always parse the first cert of a bundle (#1568)
    • SSH2: behave like putty with broken publickey auth (#1572)
    • SSH2: don't close channel on unexpected response to channel request (#1631)
    • RSA: support keys with PSS algorithm identifier (#1584)
    • RSA: cleanup RSA PKCS#1 v1.5 signature verification (CVE-2021-30130)
    • SFTP/Stream: make it so you can write past the end of a file (#1618)
    • SFTP: fix undefined index notice in stream touch() (#1615)
    • SFTP: digit only filenames were converted to integers by php (#1623)
    • BigInteger: fix issue with toBits on 32-bit PHP 8 installs
    • Crypt: use a custom error handler for mcrypt to avoid deprecation errors

    2.0.30 - 2020-12-16

    • X509: don't attempt to parse multi-cert PEMs (#1542)
    • SFTP: add stream to get method (#1546)
    • SFTP: progress callback should report actual downloaded bytes (#1543)
    • SSH2: end connection faster for algorithm mismatch
    • SSH2: add setKeepAlive() method (#1529)
    • ANSI: fix PHP8 compatibility issues

    2.0.29 - 2020-09-07

    • SFTP: add enableDatePreservation() / disableDatePreservation() (#1496)
    • SFTP: uploads on low speed networks could get in infinite loop (#1507)
    • SSH2: when building algo list look at if crypto engine is set (#1500)
    • X509: really looong base64 encoded strings broke extractBER() (#1486)

    2.0.28 - 2020-07-08

    • SFTP: realpath('') produced an error (#1474)
    • SFTP: if /path/to/file is a file then /path/to/file/whatever errors (#1475)
    • SFTP: speed up uploads (by changing SFTP upload packet size from 4KB to 32KB)
    • ANSI: fix "Number of elements can't be negative" error

    2.0.27 - 2020-05-22

    • SFTP: another attempt at speeding up uploads (#1455)
    • SSH2: try logging in with none as an auth method first (#1454)
    • ASN1: fix for malformed ASN1 strings (#1456)

    2.0.26 - 2020-03-22

    • SFTP: another attempt at speeding up uploads (#1455)
    • SSH2: try logging in with none as an auth method first (#1454)
    • ASN1: fix for malformed ASN1 strings (#1456)

    2.0.25 - 2020-02-25

    ... (truncated)

    Commits
    • 233a920 CHANGELOG: add 2.0.31 release
    • 364704a Merge branch '1.0' into 2.0
    • 05550b9 Merge pull request #1635 from terrafrost/moosa-1.0
    • f95b039 Merge branch 'moosa-1.0' into moosa-2.0
    • 149b4d2 RSA: fix for PHP8
    • 74435e1 Merge branch 'moosa-1.0' into moosa-2.0
    • 8af4280 RSA: misc fixes for 'without NULL' PKCS1 signature validation
    • d70abb9 fix broken unit test
    • 43eeb85 Merge branch 'moosa-1.0' into moosa-2.0
    • 581fbdb CS adjustments
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Inject Logger for error logging when using AMQP …

    Inject Logger for error logging when using AMQP …

    • New optional requirement LoggingInterface form AmqpTransport.php
    • Improve AmqpEvent.php ** Move deadLetter decision to AmqpEvent ** add a EventId (based on UUID4 as default using ramsey/uuid) ** add setter to set lastError message to Event to improve debugging
    opened by sleipi 0
  • Separate AMQP specifics from Event Interface

    Separate AMQP specifics from Event Interface

    The Event Interface brings a lot of AMQP releated stuff. So it would be a good idea to separate getRoutingKey, getExchange, getMaxRetryCount from the generic Event Interface.

    Furthermore, Implement a late binding in AmqpTransport.

    opened by sleipi 0
Releases(0.17.2)
Owner
JTL Software
JTL Software
Hashtopolis is a multi-platform client-server tool for distributing hashcat tasks to multiple computers.

Hashtopolis is a multi-platform client-server tool for distributing hashcat tasks to multiple computers. The main goals for Hashtopolis's development are portability, robustness, multi-user support, and multiple groups management.

Hashtopolis 1.1k Jan 4, 2023
Transaction-aware Event Dispatcher for Laravel

Transaction-aware Event Dispatcher for Laravel This Laravel package introduces Transaction-aware Event Dispatcher. It ensures the events dispatched wi

Francisco Neves 299 Nov 29, 2022
An HTTP Interop compatible middleware dispatcher in Equip

An HTTP Interop compatible middleware dispatcher in Equip. Attempts to be PSR-1, PSR-2, PSR-4, PSR-7, and PSR-15 compliant.

Equip 24 Aug 10, 2022
A package to flash multiple messages using Laravels default session message flashing system

Flash multiple advanced messages with both text, messages and links An opinionated solution for flashing multiple advanced messages from the backend a

Bilfeldt 6 Jan 18, 2022
Message box application written in Laravel - simple inbox design using auth UI.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

null 0 Dec 25, 2021
Disque is a distributed message broker

Disque, an in-memory, distributed job queue Disque is an ongoing experiment to build a distributed, in-memory, message broker. Its goal is to capture

Salvatore Sanfilippo 7.9k Jan 7, 2023
Migrator is a GUI migration manager for Laravel which you can create, manage and delete your migration.

Migrator Migrator is a GUI migration manager for Laravel which you can create, manage and delete your migration. Installation: To install Migrator you

Reza Amini 457 Jan 8, 2023
A Laravel 8 Project Implement with GraphQL With Sanctum APIs Authentications Which utilized in Any Frontend or Any Mobile Application Programs.

A Laravel 8 Project Implement with GraphQL With Sanctum APIs Authentications Which utilized in Any Frontend or Any Mobile Application Programs.

Vikas Ukani 3 Jan 6, 2022
Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology.

Stash View Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology. What is Russian Doll Caching ? It i

Bhushan Gaikwad 18 Nov 20, 2022
Load head metadata from a manifest file which can be shared with a SPA project

Laravel Head Manifest Installation Step 1: Add Laravel Head Manifest to your laravel project composer require critiq/laravel-head-manifest Step 2: Add

Critiq 1 Nov 17, 2021