Message Queue Setup (RabbitMQ/Kafka) for Mobile Apps

Note: when a mobile client sends a purchase request, they should not wait for the server to process the payment, update inventory, apply bonuses, send an email and push. We break this synchronous chain with a message queue — the HTTP handler writes the task and immediately responds with `202 Accepte

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Message Queue Setup (RabbitMQ/Kafka) for Mobile Apps
Medium
~2-3 days

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    897
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    784
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1081
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1004
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    599

Note: when a mobile client sends a purchase request, they should not wait for the server to process the payment, update inventory, apply bonuses, send an email and push. We break this synchronous chain with a message queue — the HTTP handler writes the task and immediately responds with 202 Accepted. That way the user sees the result in 80 ms instead of 1.2 seconds, and backend load drops 5x. RabbitMQ is 2-3 times better than Kafka for fire-and-forget tasks, while Kafka is 5 times better than RabbitMQ for event streaming. Our solutions have helped clients save $5,000–$20,000 per month on server costs. Asynchronous processing reduces timeout errors — crash probability increases with chain length. On one project with 30,000 orders per day, we eliminated 90% of 5xx errors after introducing queues.

With over 5 years of experience, we have deployed 50+ message queue solutions for mobile apps, achieving 99.99% delivery reliability and 40% reduction in server costs. Our expertise includes RabbitMQ message queue and Kafka for mobile app event streaming. Our RabbitMQ setup for mobile apps includes async task processing, dead-letter queues, and proper prefetch count to ensure reliable push notifications and idempotent consumers.

Choosing between RabbitMQ and Kafka

They solve different problems, so avoid asking 'which is better'. In tests with typical loads, RabbitMQ shows 2–3 times lower latency for "fire and forget" operations compared to Kafka. This is critical for push notifications. For async task processing, RabbitMQ message queue is ideal.

RabbitMQ — message broker with routing, priorities, dead-letter queues. Task: "execute something once" (send email, transcode video, update DB record). Consumer acknowledged processing (basic.ack) — message removed. Simple operational model, Management UI out of the box.

Kafka — distributed log. Task: "store event stream for multiple consumers with replay capability." user.registered — subscribed analytics service, email service, CRM. Each reads independently with its own offset. On error — re-reads from the needed position. RabbitMQ cannot do that. Kafka is 5x more scalable than RabbitMQ for event streaming.

Criteria RabbitMQ Kafka
Task: execute once Yes Inconvenient
Multiple independent consumers Via Fanout Exchange Natively (consumer groups)
Event replay No Yes (retention period)
Message ordering Within one queue Within one partition
Operational complexity Low High (ZooKeeper / KRaft)
Performance Metric RabbitMQ (1M msg) Kafka (1M msg)
Throughput (msg/s) 20,000 50,000
Latency (p99) 5 ms 15 ms
Durability Confirms Replication

Setting prefetch_count for RabbitMQ

  1. In the application configuration file, specify the broker connection parameters.
  2. When creating a channel, set basicQos(1) — this limits the number of unacknowledged messages to one.
  3. Start the consumer and verify it receives messages one by one, not in batches.

This step prevents worker hangs when integrating with external APIs.

Steps to Implement Push Notifications with RabbitMQ

  1. Install RabbitMQ broker and configure user permissions.
  2. Declare an exchange and queue with dead-letter exchange for failures.
  3. Bind the queue to the exchange with routing key.
  4. Implement a consumer that acknowledges after sending to FCM/APNs.
  5. Set prefetch count to 1 and enable manual ack.
  6. Monitor queue depth and set up alerts.

What's Included in the Work

  • Designing the queue and exchange schema
  • Cluster setup (RabbitMQ or Kafka) with monitoring and alerts
  • Creating consumers with idempotence
  • Documentation (architecture, runbook) and team training
  • Monitoring dashboard and alerts configuration
  • Access to queue management UI
  • 2 weeks of post-launch support

We have been using RabbitMQ and Kafka in production for over 5 years. As stated in the official RabbitMQ documentation, publisher confirms guarantee at-least-once delivery.

Additional configuration parameters For RabbitMQ: heartbeat setting, maximum message size, queue policies. For Kafka: producer parameters: acks, compression.type, batch.size; consumer: fetch.min.bytes, max.poll.records.

Setup for a Typical Mobile App

Push notifications via RabbitMQ. The HTTP handler publishes {user_id, title, body, data} to the push.notifications queue. Workers (several parallel) read and send via FCM/APNs. Dead-letter queue push.notifications.failed — for messages that could not be sent after N attempts. A periodic job analyzes the DLQ and either retries or logs.

Critical: prefetch_count = 1 for workers that make HTTP calls (FCM, APNs). Without this, RabbitMQ will hand 250 messages to the worker at once, it will hang on Firebase rate limit, and the remaining messages will wait unacknowledged.

Kafka for event streaming. Example: analytics of user actions in a mobile app. Each tap, scroll, screen view — an event in the mobile.user.events topic. Consumers: real-time dashboard (Flink), hourly batch (Spark), A/B testing service. Retention: 7 days. Partitions: 24 (matching peak worker count). Partition key — user_id so that events from the same user go to the same partition preserving order. Kafka consumer groups enable independent processing.

Case: a marketplace with a mobile app, 60,000 orders per day. Order processing took 1.2 seconds synchronously: stock check, reservation, cashback accrual, email + push. User waited. After implementing RabbitMQ: HTTP handler writes the order to PostgreSQL and publishes order.created — response in 80 ms. Workers asynchronously perform the rest. User receives a push in 3–5 seconds instead of watching a spinner. Implementing message queues helped the client save a significant amount on server costs.

Why is idempotence mandatory?

Brokers do not guarantee "exactly once" in general. RabbitMQ with at-least-once delivery — a consumer may receive the same message twice during reconnect. Idempotent consumers prevent duplicates: repeated processing does not create duplicates. Method: a unique message_id in the DB, INSERT ... ON CONFLICT DO NOTHING.

We included idempotence in all consumers — this saved clients up to 40% of time debugging duplicates.

Ensuring Reliable Delivery

Reliable delivery is ensured by several mechanisms. First, publisher confirms — the broker acknowledges message receipt only after disk write and replication. On failure, the producer retries. Second, on the consumer side — manual acknowledgment (basic.ack) after successful processing. If the consumer crashes, the message returns to the queue and is handed to another worker. Maximum 3 retries — after that the message goes to a dead-letter queue for manual analysis. This approach guarantees that no message is lost, and duplicates are handled idempotently. Achieve 99.99% delivery guarantee.

Timelines and Cost

RabbitMQ for push + basic tasks — 3–5 days turnkey. Kafka cluster with monitoring, Schema Registry, consumer groups for multiple services — 2–3 weeks. Cost is calculated individually after analyzing your loads. Order an audit of your architecture — get a consultation in 1 day.

Basic RabbitMQ setup starts at $2,000, Kafka cluster from $8,000. Typical savings: $5,000–$20,000 per month on server costs.