genhoi/humus-amqp-bundle

Integrates the HumusAmqp library into Symfony

Installs: 2 112

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 1

Open Issues: 0

Type:symfony-bundle

v2.2.0 2021-08-06 08:40 UTC

README

About

This bundle integrates the HumusAmqp library into Symfony.

Installation

Require the bundle and its dependencies with composer:

$ composer require genhoi/humus-amqp-bundle

For Symfony Framework >= 4.3

Register the bundle:

// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        new Humus\AmqpBundle\HumusAmqpBundle(),
    ];
}

For application that uses Symfony Dependency Injection component

Register the extension:

use Humus\AmqpBundle\DependencyInjection\HumusAmqpExtension;

// ...

$containerBuilder->registerExtension(new HumusAmqpExtension());

Usage

Add the humus section in your configuration file:

humus:
  amqp:
    driver: amqp-extension
    connection:
      default:
        vhost: "/"
        login: guest
        password: guest
        host: rabbitmq
        port: 5672
        connect_timeout: 10
        read_timeout: 10
        write_timeout: 10
    exchange:
      test_exchange:
        connection: default
        durable: true
        type: direct
      test_rpc_client:
        connection: default
        type: direct
      test_rpc_server:
        connection: default
        type: direct
    queue:
      test_queue:
        connection: default
        durable: true
        auto_setup_fabric: true
        auto_setup_exchanges: true
        arguments:
          x-dead-letter-exchange: test_exchange
          x-dead-letter-routing-key: delayed
        exchanges:
          test_exchange:
            routing_keys:
            - ''
            - key-1
      test_queue_delayed:
        connection: default
        durable: true
        auto_setup_fabric: true
        auto_setup_exchanges: true
        exchanges:
          test_exchange:
            routing_keys:
            - delayed
      test_rpc_client:
        connection: default
        exchanges:
          test_rpc_client: []
      test_rpc_server:
        connection: default
        name: test_rpc_server
        exchanges:
          test_rpc_server: []
    callback_consumer:
      test_queue_consumer:
        queue: test_queue
        delivery_callback: HumusTest\AmqpBundle\Functional\Callback\ConsumerDeliveryCallback
        error_callback: HumusTest\AmqpBundle\Functional\Callback\ConsumerErrorCallback
        logger: monolog
        qos:
          prefetch_count: 3
          prefetch_size: 0
    producer:
      test_producer:
        type: json
        exchange: test_exchange
    json_rpc_server:
      test_rpc_server:
        delivery_callback: HumusTest\AmqpBundle\Functional\Callback\RpcDeliveryCallback
        idle_timeout: 10
        queue: test_rpc_server
    json_rpc_client:
      test_rpc_client:
        queue: test_rpc_client
        exchanges:
        - test_rpc_server