Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Clarc Message Bus Bundle Laravel Package

artox-lab/clarc-message-bus-bundle

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Clean Architecture Alignment: The bundle enforces Clean Architecture principles by decoupling domain events from infrastructure (e.g., RabbitMQ). This aligns well with Laravel/Symfony-based projects seeking event-driven or CQRS patterns.
  • Symfony Messenger Integration: Leverages Symfony’s messenger component, which is compatible with Laravel’s event system (via bridges like symfony/messenger or custom implementations). However, Laravel’s native event system is simpler, so this may introduce unnecessary complexity unless event sourcing/CQRS is a core requirement.
  • Domain-Driven Design (DDD) Support: Encourages explicit event modeling (via abstract-bus-event-message), which is valuable for complex domains but may feel over-engineered for simpler Laravel apps.

Integration Feasibility

  • Laravel Compatibility:
    • Symfony Messenger: Requires symfony/messenger (not natively in Laravel). Possible via:
      • Laravel Messenger Bridge (spatie/laravel-messenger) or
      • Custom integration (e.g., wrapping Symfony Messenger in a Laravel service provider).
    • RabbitMQ Dependency: Hardcodes RabbitMQ (via old_sound_rabbit_mq or Symfony’s amqp-transport). Laravel projects might prefer database queues, Redis, or Pusher.
  • Event Serialization: Uses a custom serializer (artox_lab_clarc_message_bus.transport.bus_serializer), which may conflict with Laravel’s native JSON serialization or packages like spatie/laravel-activitylog.

Technical Risk

  • Low Maturity: No stars, last release in 2021, and minimal documentation. Risk of:
    • Deprecated dependencies (e.g., symfony/messenger:^5.0 may not align with Laravel’s ecosystem).
    • Unmaintained code (e.g., no security patches, broken RabbitMQ setup).
  • Complexity Overhead:
    • Requires custom event classes, message factories, and middleware configuration—adding boilerplate for basic use cases.
    • Topic Exchange Setup: Manual queue binding (via rabbitmq:setup-fabric) is error-prone and non-portable.
  • Laravel-Specific Gaps:
    • No native support for Laravel’s service container, queues, or event listeners.
    • Potential namespace collisions with Laravel’s Event classes.

Key Questions

  1. Why RabbitMQ?
    • Is RabbitMQ a hard requirement, or could this be replaced with Laravel’s native queues (database/Redis)?
  2. Event Complexity
    • Does the project need DDD-level event modeling, or would Laravel’s simpler Event system suffice?
  3. Maintenance Burden
    • Who will handle updates/bug fixes if the package stagnates?
  4. Alternatives
  5. Performance
    • How will serialization/deserialization compare to Laravel’s native JSON or packages like spatie/laravel-activitylog?

Integration Approach

Stack Fit

  • Symfony/Laravel Hybrid:
    • Best suited for Symfony apps or Laravel projects already using Symfony Messenger.
    • For pure Laravel, bridge packages (e.g., spatie/laravel-messenger) or custom adapters are needed.
  • Event-Driven Architecture:
    • Ideal for CQRS, event sourcing, or microservices where events are a first-class citizen.
    • Overkill for CRUD-heavy apps or simple pub/sub needs.
  • Transport Layer:
    • RabbitMQ: High throughput but complex setup. Alternatives:
      • Laravel Queues (database/Redis) for simplicity.
      • AWS SQS/SNS or Kafka for scalability.

Migration Path

  1. Assess Current Event System:
    • Audit existing Laravel events/listeners. Identify candidates for message bus migration.
  2. Symfony Messenger Integration:
    • Install symfony/messenger and spatie/laravel-messenger:
      composer require symfony/messenger spatie/laravel-messenger
      
    • Configure config/messenger.php to match the bundle’s structure.
  3. Custom Event Mapping:
    • Create a mapping layer to convert Laravel events → BusEventMessage:
      // Example: Event to BusEventMessage converter
      use ArtoxLab\AbstractBusEventMessage\V1\BusMessageInterface;
      
      class LaravelEventToBusMessageConverter
      {
          public function convert(\Symfony\Component\EventDispatcher\Event $event): BusMessageInterface
          {
              return new YourLib\BusEventMessage\V1\BusMessage(
                  $event->getName(),
                  $event->getArguments()
              );
          }
      }
      
  4. Transport Configuration:
    • Replace RabbitMQ with Laravel’s queue driver (e.g., database):
      # config/packages/messenger.yaml
      transports:
          async:
              dsn: 'doctrine://default'
              serializer: messenger.transport.symfony_serializer
      
    • Use spatie/laravel-messenger to bridge Symfony Messenger with Laravel Queues.

Compatibility

Feature Compatibility Notes
Laravel Events Requires custom mapping to BusEventMessage.
Service Container Works with Symfony’s DI; Laravel’s container may need adapters.
Queues RabbitMQ is hardcoded; Laravel’s queue drivers need custom transport adapters.
Middleware Supports Symfony Messenger middleware (e.g., add_redelivery_stamp_middleware).
Validation Uses Symfony Validator; Laravel’s validator may need integration.

Sequencing

  1. Phase 1: Proof of Concept
    • Implement a single event type (e.g., OrderCreated) using the bundle.
    • Test with RabbitMQ locally, then migrate to Laravel queues.
  2. Phase 2: Full Integration
    • Replace all event listeners with message bus consumers.
    • Add retry logic (via Symfony Messenger’s retry_strategy).
  3. Phase 3: Optimization
    • Benchmark performance (RabbitMQ vs. Laravel queues).
    • Replace custom serializers with Laravel’s native JSON if possible.

Operational Impact

Maintenance

  • Dependency Risks:
    • Symfony Messenger: May require updates to align with Laravel’s ecosystem.
    • RabbitMQ: Adds operational overhead (clustering, monitoring, backups).
  • Custom Code:
    • Event factories, message classes, and middleware require ongoing updates if the package evolves.
  • Debugging:
    • Complex event flows may obscure errors (e.g., failed RabbitMQ connections, serialization issues).

Support

  • Limited Community:
    • No stars/issues mean no community support. Debugging will rely on:
      • GitHub issues (unlikely to be active).
      • Reverse-engineering the codebase.
  • Vendor Lock-in:
    • Custom event structures may make it hard to switch to other message buses (e.g., Laravel’s native queues).

Scaling

  • Horizontal Scaling:
    • RabbitMQ supports scaling, but Laravel’s database queues may be simpler for small-to-medium apps.
    • Consumer Groups: RabbitMQ’s topic exchanges require manual queue binding (scalability depends on rabbitmq:setup-fabric).
  • Performance:
    • Pros: RabbitMQ offers low-latency and high throughput for event-heavy workloads.
    • Cons: Overhead of AMQP protocol, serialization, and middleware may impact small apps.

Failure Modes

Scenario Impact Mitigation Strategy
RabbitMQ Down Events lost if not persisted (e.g., no dead-letter queue). Use persistent queues and retry policies.
Serialization Errors Events fail silently or corrupt. Add validation middleware and logging.
Middleware Failures Retry logic may loop indefinitely. Configure max retries and circuit breakers.
Laravel Queue Driver Issues If migrating to Laravel queues, driver-specific bugs may arise. Test with database/Redis queues and monitor failures.
Package Abandonment No updates for critical vulnerabilities. Fork the repo or replace with spatie/laravel-event-sourcing.

Ramp-Up

  • Learning Curve:
    • High for teams unfamiliar with:
      • Symfony Messenger.
      • RabbitMQ/
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky