Public | Automated Build

Last pushed: 8 months ago
Short Description
Arpanet - API Gateway
Full Description

Arpanet - API Gateway

API Gateway baseada no microframework Silex com ferramentas de teste, integração ao RabbitMQ para chamadas assincronas e cliente HTTP Guzzle para chamada síncronas e enviar chamadas de retorno.

Um servidor RabbitMQ é nescessário para gerenciar as chamadas assíncronas.

Caso de uso:

  1. Controller Receive an HTTP request with an operation id, parameters and a callback URL. Response Working on it.
  2. Manager Construct the operation.
  3. Producer Send a message with the operation to the RabbitMQ server queue.
  4. Consumer's Consume the message from the RabbitMQ server queue.
  5. Manager Process the operation and send an HTTP request to the callback URL with the operation result.

Consumers are running processes that keep listening to the queue messages.
A console command bin/console app:consumer is provided to launch consumers and delegate the operation process logic to the manager but a really simple script is all that is needed to launch a consumer. If your consumers are external to the app, you may put the operation process logic in them.

Estrutura

app/
    bin/       <- Executáveis (console, behat, ...)
    config/    <- Configurações de ambiente
    features/  <- Behat features
    spec/      <- PHPSpec specs
    src/       <- Code, default namespace
    tests/     <- PHPUnit tests
    var/
        cache/
        logs/
    public/    <- Pasta web pública
config/        <- Configurações adicionais

Começando

  1. composer install
  2. Edit the config files and configure the RabbitMQ server parameters.
  3. Point your virtual host to the public\ folder.
  4. Edit behat.yml.dist and replace the base_url value with your virtual host.

Testando

A simple example is provided for each testing tool:

  • Behat: features/example.feature
  • PHPSpec: spec/ExampleSpec.php
  • PHPUnit: tests/ExampleTest.php

Run them with:

bin/behat --format pretty
bin/phpspec run --format pretty
bin/phpunit

Licença

Copyright (C) WeDev Brasil - Todos os direitos reservados LICENSE.

Docker Pull Command
Owner
arpanet
Source Repository

Comments (0)