承接 happyr/simplebus-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

happyr/simplebus-bundle

Composer 安装命令:

composer require happyr/simplebus-bundle

包简介

How Happyr use SimpleBus

README 文档

README

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

This bundle includes all the nice extra features Happyr needs for their SimpleBus installation. The purpose is not to be 100% resuable and flexible. Feel free to for it and adjust it for your needs.

Installation

composer require happyr/simplebus-bundle
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Happyr\SimpleBusBundle\HappyrSimpleBusBundle(), // <-- Make sure this is before the SimpleBusBrige bundles. 
            new Happyr\Mq2phpBundle\HappyrMq2phpBundle(),
            new SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle(),
            new SimpleBus\SymfonyBridge\SimpleBusEventBusBundle(),
            new SimpleBus\AsynchronousBundle\SimpleBusAsynchronousBundle(),
            new SimpleBus\RabbitMQBundleBridge\SimpleBusRabbitMQBundleBridgeBundle(),
            new SimpleBus\JMSSerializerBundleBridge\SimpleBusJMSSerializerBundleBridgeBundle(),
            new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),
            new SimpleBus\JMSSerializerBundleBridge\SimpleBusJMSSerializerBundleBridgeBundle(),
        ];
        // ...
    }
    // ...
}
# /app/config/happyr_simplebus.yml

parameters:
  app.command_queue: 'commands'
  app.event_queue: 'events'
  simple_bus.command_bus.logging.level: info
  simple_bus.event_bus.logging.level: info

happyr_mq2php:
  enabled: true
  secret_key: 'CHANGE_ME'
  command_queue: "%app.command_queue%"
  event_queue: "%app.event_queue%"
  message_headers:
    fastcgi_host: "%fastcgi_host%"
    fastcgi_port: "%fastcgi_port%"
    dispatch_path: "%mq2php_dispatch_path%"

command_bus:
  logging: ~

event_bus:
  logging: ~

simple_bus_rabbit_mq_bundle_bridge:
  commands:
    # this producer service will be defined by OldSoundRabbitMqBundle,
    # its name is old_sound_rabbit_mq.%producer_name%_producer
    producer_service_id: old_sound_rabbit_mq.asynchronous_commands_producer
  events:
    # this producer service will be defined by OldSoundRabbitMqBundle,
    # its name is old_sound_rabbit_mq.%producer_name%_producer
    producer_service_id: old_sound_rabbit_mq.asynchronous_events_producer

simple_bus_asynchronous:
  events:
    strategy: 'predefined'

old_sound_rabbit_mq:
  connections:
    default:
      host:     "%rabbitmq_host%"
      port:     5672
      user:     'guest'
      password: 'guest'
      vhost:    '/'
      lazy:     false
      connection_timeout: 3
      read_write_timeout: 3

      # requires php-amqplib v2.4.1+ and PHP5.4+
      keepalive: false

      # requires php-amqplib v2.4.1+
      heartbeat: 0
  producers:
    asynchronous_commands:
      connection:       default
      exchange_options: { name: '%app.command_queue%', type: "x-delayed-message", arguments: {"x-delayed-type": ["S","direct"]} }
      queue_options:    { name: "%app.command_queue%", durable: true }

    asynchronous_events:
      connection:       default
      exchange_options: { name: '%app.event_queue%', type: "x-delayed-message", arguments: {"x-delayed-type": ["S","direct"]} }
      queue_options:    { name: "%app.event_queue%", durable: true }

Continue to read at Mq2phpBundle. Make sure to install the RabbitMQ extension for delayed messages.

Use

Create your messages in

src/App/Message
  Command
  CommandHandler
  Event
  EventSubscriber

And they will be auto wired and registered automatically. You may of course register them manually.

Classes & Interfaces

Be aware of the following base classes.

  • BaseCommandHandler
  • BaseEventSubscriber implements AutoRegisteredEventSubscriber
  • HandlesMessagesAsync (For async handlers/subscribers)
  • DelayedMessage (For async messages with a delay)

Direct publisher

If do not want to use a queue you may use the direct publisher.

happyr_simplebus:
  use_direct_publisher: true

统计信息

  • 总下载量: 20.95k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固