Skip to content

Latest commit

 

History

History
108 lines (75 loc) · 3.21 KB

README.md

File metadata and controls

108 lines (75 loc) · 3.21 KB

AsyncAPI

Software License

AsyncAPI is a wrapper for Message-driven API's built on top of most used industry plugins such as PHP AMQP lib for RabbitMQ. It is built for usage altogether with AsyncAPI specs and generators

Structure

The structure for this plugin is as follows

configs/
examples/
src/
tests/
vendor/

Install

You need to have the asyncapi/generator installed and a valid AsyncAPI specification file.

$ npm install -g @asyncapi/generator

Usage

Once you hvae the generator installed, you can try to generate code from any valid AsyncAPI file

./utilities/generate.sh -o {output} -s {sourceYamlFile}

Refer to the examples folder for further details on PHP usage

$brokerAPI = new AsyncAPI();
$factory = $brokerAPI->init();

/** @var \{{ params.packageName }}\Applications\Subscriber $subscriber */
$subscriber = $factory->createApplication(
    SUBSCRIBER_KEY,
    [
        BROKER_HOST_KEY         => 'localhost',
        BROKER_USER_KEY         => 'guest',
        BROKER_PASSWORD_KEY     => 'guest',
        BROKER_PORT_KEY         => '5672',
        BROKER_VIRTUAL_HOST_KEY => '/',
    ]
);

$message = $factory->createMessage(
    Example::class,
    [
        'id' => 1,
    ]
);

$subscriber->requestExampleById($message);

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email ezublena@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.