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

Stomp Laravel Package

enqueue/stomp

Enqueue STOMP transport: a Queue Interop implementation for sending and consuming messages over the STOMP protocol. Includes docs and community support resources; MIT licensed.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Use Case Alignment: The enqueue/stomp package is a STOMP transport implementation for the Queue Interop specification, enabling PHP applications to interact with STOMP-compatible message brokers (e.g., Apache ActiveMQ, RabbitMQ, or any STOMP server). This is a strong fit for Laravel applications requiring asynchronous task processing, event-driven workflows, or distributed messaging without vendor lock-in.
  • Laravel Ecosystem Synergy: While Laravel has its own queue system (via laravel/queue), this package provides alternative transport for scenarios where:
    • STOMP-based brokers (e.g., RabbitMQ) are already in use.
    • Cross-language interoperability is needed (e.g., Java/Kotlin services consuming PHP queues).
    • Advanced STOMP features (e.g., durable queues, transactions, or complex routing) are required.
  • Abstraction Layer: The package adheres to Queue Interop, meaning it can replace Laravel’s default queue drivers (e.g., sync, database, redis) with minimal code changes, leveraging Laravel’s queue:work command or custom consumers.

Integration Feasibility

  • Laravel Queue Integration:
    • The package can be plugged into Laravel’s queue system by extending the Illuminate\Queue\QueueManager or using a custom queue driver (via extend() in config/queue.php).
    • Example:
      Queue::extend('stomp', function ($app) {
          return new StompQueue(
              new \Enqueue\Stomp\StompConnectionFactory(),
              $app['config']['queue.stomp']
          );
      });
      
    • Supports delayed jobs, retry logic, and fail queues if configured properly.
  • STOMP Broker Setup:
    • Requires a STOMP-compatible broker (e.g., RabbitMQ with STOMP plugin, ActiveMQ). This adds infrastructure complexity but aligns with microservices or hybrid architectures.
    • Configuration involves DSN (Data Source Name) for connection (e.g., stomp://user:pass@host:port).

Technical Risk

Risk Area Assessment
Broker Dependency High. Requires a running STOMP server (e.g., RabbitMQ). Downtime or misconfiguration here directly impacts queue reliability.
Compatibility Medium. STOMP brokers may have protocol quirks (e.g., RabbitMQ’s STOMP plugin vs. ActiveMQ). Testing with the target broker is critical.
Performance Medium. STOMP overhead may introduce latency compared to Redis or database queues. Benchmarking is recommended for high-throughput workloads.
Laravel Integration Low. The Queue Interop standard ensures seamless replacement of Laravel’s default drivers, but custom logic (e.g., job middleware) may need adjustments.
Security Medium. STOMP connections must be encrypted (SSL/TLS) and credentials managed securely (e.g., Laravel’s env()).
Monitoring High. Lack of built-in Laravel queue monitoring (e.g., queue:failed-table). Requires custom metrics (e.g., Prometheus) or broker-specific tools (e.g., RabbitMQ Management UI).

Key Questions

  1. Why STOMP?
    • Is the goal cross-language messaging, advanced routing, or existing broker infrastructure?
    • Could alternatives (e.g., laravel/queue with Redis/RabbitMQ AMQP) achieve the same with less complexity?
  2. Broker Selection
    • Which STOMP broker is being used? Are there known compatibility issues with this package?
    • What are the scaling limits of the broker (e.g., RabbitMQ’s message TTL, prefetch counts)?
  3. Failure Handling
    • How will failed jobs be handled? Laravel’s queue:failed-table won’t work; a custom dead-letter queue (DLQ) must be configured.
    • What’s the retry strategy for poison pills or transient failures?
  4. Observability
    • How will job progress, latency, and errors be monitored? Will Prometheus/Grafana or broker tools be used?
  5. Cost
    • Is the STOMP broker self-hosted or a managed service (e.g., CloudAMQP)? What are the operational costs?

Integration Approach

Stack Fit

  • Laravel Version: Compatible with Laravel 9+ (PHP 8.1+). No breaking changes expected for newer Laravel versions.
  • Dependencies:
    • Core: stomp-php/stomp-php (STOMP client), queue-interop/queue-interop (standard).
    • Optional: guzzlehttp/guzzle (for HTTP-based STOMP over WebSocket), andrewmy/rabbitmq-management-api (if RabbitMQ-specific features are needed).
  • Alternatives Considered:
    • Laravel’s AMQP Driver: If using RabbitMQ, php-amqplib/php-amqplib might be simpler but lacks STOMP interoperability.
    • Redis Queue: Lower latency but no cross-language support.

Migration Path

  1. Assessment Phase:
    • Audit existing queue jobs to identify STOMP-specific requirements (e.g., headers, transactions).
    • Benchmark throughput/latency against current queue driver.
  2. Proof of Concept (PoC):
    • Set up a local STOMP broker (e.g., RabbitMQ with STOMP plugin).
    • Implement a custom queue driver in Laravel (see example above).
    • Test with critical jobs (e.g., payments, notifications).
  3. Gradual Rollout:
    • Start with non-critical queues (e.g., analytics, logs).
    • Monitor job failures, latency, and broker metrics.
    • Replace default driver in config/queue.php:
      'stomp' => [
          'dsn' => env('QUEUE_STOMP_DSN', 'stomp://guest:guest@localhost:61613'),
          'options' => [
              'heartbeat' => 3000,
              'connect_timeout' => 5,
          ],
      ],
      
  4. Fallback Strategy:
    • Keep the original queue driver as a backup during migration.
    • Use Laravel’s queue:retry and queue:failed commands (with custom DLQ logic).

Compatibility

  • Queue Interop Compliance: The package fully supports the Queue Interop standard, meaning it works with any Laravel queue consumer (e.g., queue:work, Horizon, or custom workers).
  • Laravel Features:
    • Delayed Jobs: Supported via release($delay).
    • Job Middleware: Works as long as middleware doesn’t rely on Laravel-specific queue features (e.g., AfterCommit).
    • Events: STOMP can dispatch Laravel events if wrapped in a job.
  • Limitations:
    • No built-in Horizon support: Custom monitoring will be needed.
    • No database-backed retries: Retry logic must be implemented in the job or broker.

Sequencing

  1. Infrastructure Setup:
    • Deploy and configure the STOMP broker (e.g., RabbitMQ with STOMP plugin).
    • Secure connections (TLS, credentials).
  2. Laravel Configuration:
    • Add the package via Composer:
      composer require enqueue/stomp enqueue/dsn
      
    • Configure the queue driver in config/queue.php.
  3. Job Adaptation:
    • Update jobs to handle STOMP-specific headers (e.g., reply-to, priority).
    • Implement custom retry logic if needed.
  4. Testing:
    • Test job dispatching, consumption, and failures in staging.
    • Load test with expected peak traffic.
  5. Monitoring:
    • Set up broker metrics (e.g., RabbitMQ’s rabbitmqctl).
    • Log STOMP connection issues (e.g., timeouts, authentication failures).

Operational Impact

Maintenance

  • Broker Maintenance:
    • STOMP brokers require regular updates, backups, and monitoring (e.g., RabbitMQ cluster health).
    • High availability may need multi-node setups (e.g., RabbitMQ mirrored queues).
  • Laravel-Specific:
    • No additional Laravel maintenance, but custom queue drivers may need updates if the package evolves.
    • Dependency updates: stomp-php/stomp-php and enqueue/dsn may require occasional updates.

Support

  • Troubleshooting:
    • Connection Issues: STOMP timeouts or authentication failures are common. Debugging requires checking **broker
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport