amqp.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. use Hyperf\Amqp\IO\IOFactory;
  12. use function Hyperf\Support\env;
  13. return [
  14. 'enable' => true,
  15. 'default' => [
  16. 'host' => env('AMQP_HOST', 'localhost'),
  17. 'port' => (int) env('AMQP_PORT', 5672),
  18. 'user' => env('AMQP_USER', 'guest'),
  19. 'password' => env('AMQP_PASSWORD', 'guest'),
  20. 'vhost' => env('AMQP_VHOST', '/'),
  21. 'open_ssl' => false,
  22. 'concurrent' => [
  23. 'limit' => 2,
  24. ],
  25. 'pool' => [
  26. 'connections' => 2,
  27. ],
  28. 'io' => IOFactory::class,
  29. 'params' => [
  30. 'insist' => false,
  31. 'login_method' => 'AMQPLAIN',
  32. 'login_response' => null,
  33. 'locale' => 'en_US',
  34. 'connection_timeout' => 3,
  35. // Try to maintain twice value heartbeat as much as possible
  36. 'read_write_timeout' => 6,
  37. 'context' => null,
  38. 'keepalive' => true,
  39. // Try to ensure that the consumption time of each message is less than the heartbeat time as much as possible
  40. 'heartbeat' => 3,
  41. 'channel_rpc_timeout' => 0.0,
  42. 'close_on_destruct' => false,
  43. 'max_idle_channels' => 10,
  44. ],
  45. ],
  46. ];