AmqpFactory example



        $this->connectionOptions = array_replace_recursive([
            'delay' => [
                'exchange_name' => 'delays',
                'queue_name_pattern' => 'delay_%exchange_name%_%routing_key%_%delay%',
            ],
        ]$connectionOptions);
        $this->autoSetupExchange = $this->autoSetupDelayExchange = $connectionOptions['auto_setup'] ?? true;
        $this->exchangeOptions = $exchangeOptions;
        $this->queuesOptions = $queuesOptions;
        $this->amqpFactory = $amqpFactory ?? new AmqpFactory();
    }

    /** * Creates a connection based on the DSN and options. * * Available options: * * * host: Hostname of the AMQP service * * port: Port of the AMQP service * * vhost: Virtual Host to use with the AMQP service * * user|login: Username to use to connect the AMQP service * * password: Password to use to connect to the AMQP service * * read_timeout: Timeout in for income activity. Note: 0 or greater seconds. May be fractional. * * write_timeout: Timeout in for outcome activity. Note: 0 or greater seconds. May be fractional. * * connect_timeout: Connection timeout. Note: 0 or greater seconds. May be fractional. * * confirm_timeout: Timeout in seconds for confirmation, if none specified transport will not wait for message confirmation. Note: 0 or greater seconds. May be fractional. * * queues[name]: An array of queues, keyed by the name * * binding_keys: The binding keys (if any) to bind to this queue * * binding_arguments: Arguments to be used while binding the queue. * * flags: Queue flags (Default: AMQP_DURABLE) * * arguments: Extra arguments * * exchange: * * name: Name of the exchange * * type: Type of exchange (Default: fanout) * * default_publish_routing_key: Routing key to use when publishing, if none is specified on the message * * flags: Exchange flags (Default: AMQP_DURABLE) * * arguments: Extra arguments * * delay: * * queue_name_pattern: Pattern to use to create the queues (Default: "delay_%exchange_name%_%routing_key%_%delay%") * * exchange_name: Name of the exchange to be used for the delayed/retried messages (Default: "delays") * * auto_setup: Enable or not the auto-setup of queues and exchanges (Default: true) * * * Connection tuning options (see http://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.tune for details): * * channel_max: Specifies highest channel number that the server permits. 0 means standard extension limit * (see PHP_AMQP_MAX_CHANNELS constant) * * frame_max: The largest frame size that the server proposes for the connection, including frame header * and end-byte. 0 means standard extension limit (depends on librabbimq default frame size limit) * * heartbeat: The delay, in seconds, of the connection heartbeat that the server wants. * 0 means the server does not want a heartbeat. Note, librabbitmq has limited heartbeat support, * which means heartbeats checked only during blocking calls. * * TLS support (see https://www.rabbitmq.com/ssl.html for details): * * cacert: Path to the CA cert file in PEM format. * * cert: Path to the client certificate in PEM format. * * key: Path to the client key in PEM format. * * verify: Enable or disable peer verification. If peer verification is enabled then the common name in the * server certificate must match the server name. Peer verification is enabled by default. */
Home | Imprint | This part of the site doesn't use cookies.