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

Messenger Filesystem Transport Laravel Package

alphasoft-fr/messenger-filesystem-transport

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:
    • Lightweight & Simple: Ideal for small-to-medium Laravel/Symfony projects where async messaging is needed without external dependencies (e.g., Redis, RabbitMQ, or databases).
    • Symfony Messenger Compatibility: Leverages Symfony’s Messenger component, which Laravel can integrate via symfony/messenger (via spatie/laravel-messenger or direct bridge).
    • No Infrastructure Overhead: Eliminates need for message brokers, reducing operational complexity.
    • Debuggability: JSON-based message storage enables easy inspection of queued/failed messages.
  • Cons:
    • Not Production-Grade for High Throughput: File I/O is slower than in-memory or broker-based transports (e.g., Redis). Risk of performance bottlenecks under high load.
    • No Persistent Retries: Unlike Redis/RabbitMQ, this lacks built-in retry mechanisms for transient failures (e.g., network issues).
    • Single-Node Only: No clustering or distributed processing; messages are tied to a single filesystem instance.

Integration Feasibility

  • Laravel Compatibility:
    • Requires Symfony Messenger (via spatie/laravel-messenger or manual bridge). Laravel’s native queue system (Redis, database, etc.) would need to be replaced or augmented.
    • Workaround: Use Symfony Messenger as a secondary transport for specific use cases (e.g., non-critical async tasks).
  • PHP/Laravel Stack Fit:
    • Works with PHP 7.4+ and Laravel 8+ (via Symfony Messenger compatibility).
    • Potential Conflicts: May clash with Laravel’s queue workers (queue:work) if not properly isolated.

Technical Risk

  • Performance Under Load:
    • File I/O latency could degrade performance for high-message-volume systems. Benchmark against alternatives (e.g., symfony/messenger:transport:redis).
  • Data Loss Risk:
    • No built-in durability guarantees (e.g., fsync, WAL). Messages could be lost if the filesystem crashes or disk fails.
  • Scaling Limitations:
    • No horizontal scaling; messages are local to the filesystem. Not suitable for distributed systems.
  • Dependency Risk:
    • Tight coupling to Symfony Messenger. Future Laravel changes (e.g., dropping Symfony components) may require re-architecting.

Key Questions

  1. Use Case Alignment:
    • Is this for development/testing only, or a production fallback for low-volume async tasks?
    • Are there SLA requirements for message processing (e.g., <1s latency) that this transport cannot meet?
  2. Alternatives Evaluation:
    • Compare against Laravel’s native queue drivers (e.g., database, redis) or other lightweight brokers (e.g., beanstalkd).
    • Would a hybrid approach (e.g., filesystem for dev, Redis for prod) work?
  3. Failure Handling:
    • How will failed messages be monitored/retried? (Current implementation logs to failed.log but lacks automation.)
  4. Deployment Constraints:
    • Are there shared storage limitations (e.g., Docker volumes, cloud storage) that could impact performance?
  5. Long-Term Maintenance:
    • Is the package’s low star count (0) and small contributor base a concern for stability?
    • Are there plans to add features (e.g., retries, batching) that would justify adoption?

Integration Approach

Stack Fit

  • Laravel Integration Path:
    • Option 1: Symfony Messenger Bridge (Recommended):
      • Install symfony/messenger and spatie/laravel-messenger (if available) or manually bridge Symfony Messenger to Laravel’s service container.
      • Configure FilesystemTransport as a secondary transport for non-critical async tasks.
      • Example:
        // config/messenger.php
        'transports' => [
            'filesystem' => [
                'dsn' => 'filesystem://',
                'options' => [
                    'directory' => storage_path('app/messages'),
                    'log' => env('MESSENGER_LOG', false),
                ],
            ],
        ],
        
    • Option 2: Custom Queue Driver:
      • Extend Laravel’s queue system to support Symfony Messenger transports (advanced, not recommended unless necessary).
  • PHP Version:
    • Requires PHP 7.4+ (compatible with Laravel 8+). No major conflicts expected.

Migration Path

  1. Assessment Phase:
    • Audit existing async workflows to identify low-priority tasks suitable for filesystem transport.
    • Benchmark performance against current queue drivers (e.g., Redis) for target workloads.
  2. Pilot Deployment:
    • Implement FilesystemTransport for a non-critical feature (e.g., analytics, notifications).
    • Monitor:
      • Message processing latency.
      • Filesystem I/O usage (iostat, dstat).
      • Error rates (check failed.log).
  3. Gradual Rollout:
    • Replace database queues for read-heavy async tasks (e.g., logging, reporting).
    • Avoid replacing high-throughput queues (e.g., order processing).
  4. Fallback Strategy:
    • Keep Redis/database queues as primary transports with FilesystemTransport as a secondary fallback for resilience testing.

Compatibility

  • Symfony Messenger:
    • Fully compatible with Symfony Messenger’s API. Laravel’s Bus/MessageBus can be swapped out if using spatie/laravel-messenger.
  • Laravel Ecosystem:
    • Pros:
      • No changes to Laravel’s core queue system required.
      • Works with Laravel’s event system (e.g., dispatch()) if bridged.
    • Cons:
      • No native Laravel queue worker support: Requires running Symfony’s messenger:consume command or a custom worker.
      • No queue:table migrations: Unlike Laravel’s database driver, this uses filesystem storage.
  • Third-Party Packages:
    • May conflict with packages that assume Laravel’s queue system (e.g., laravel-horizon). Test thoroughly.

Sequencing

  1. Prerequisites:
    • Install dependencies:
      composer require symfony/messenger alphasoft-fr/messenger-filesystem-transport
      
    • Configure Symfony Messenger in Laravel (see spatie/laravel-messenger for guidance).
  2. Configuration:
    • Set up messenger.yaml (or Laravel’s equivalent) with filesystem:// transport.
    • Create storage directories:
      mkdir -p storage/app/messages storage/app/messages/failed
      
  3. Worker Setup:
    • Run Symfony’s messenger consumer (instead of Laravel’s queue:work):
      php bin/console messenger:consume filesystem -vv
      
    • Alternative: Use Laravel’s queue:work with a custom worker that dispatches Symfony messages.
  4. Testing:
    • Verify message flow with:
      $this->bus->dispatch(new MyMessage());
      
    • Check storage/app/messages and failed.log for output.

Operational Impact

Maintenance

  • Pros:
    • No External Services: Reduces maintenance overhead (no Redis/RabbitMQ clusters to manage).
    • Simple Debugging: JSON files are human-readable; no need for broker-specific tools (e.g., redis-cli).
  • Cons:
    • Manual Cleanup: Old messages must be manually pruned (no TTL or auto-cleanup).
    • No Metrics: Lack of built-in monitoring (e.g., message volume, latency). Requires custom logging.
    • Dependency Updates: Must manually test compatibility with new Symfony Messenger versions.

Support

  • Pros:
    • Self-Contained: Issues are isolated to the filesystem; no network/broker dependencies.
    • Community: MIT license allows forks/modifications if needed.
  • Cons:
    • Limited Ecosystem: No official Laravel support; troubleshooting may require Symfony Messenger expertise.
    • Error Handling: Failed messages require manual intervention (no automated retries or dead-letter queues).
    • No Official Support: Package maintainer (AlphaSoft) has no public support channels (based on repo activity).

Scaling

  • Vertical Scaling:
    • Limited: Performance degrades with message volume due to filesystem I/O bottlenecks.
    • Mitigations:
      • Use SSD storage for lower latency.
      • Limit message size (JSON files grow with payload).
  • Horizontal Scaling:
    • Not Supported: Messages are tied to a single filesystem instance. No sharding or partitioning.
    • Workaround: Replicate messages across multiple filesystems (custom logic required).
  • Throughput:
    • Expected: ~100–1,000 messages/sec (benchmark-dependent). Not suitable for high-throughput systems.

Failure Modes

Failure Scenario Impact Mitigation
Filesystem full/d
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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui