Prev Next

Integration / ActiveMQ Interview Questions Intermediate

1. What is the difference between Queue and Topic in ActiveMQ?

Queues and Topics implement JMS's two messaging models and behave very differently once more than one consumer is involved. Queue Topic Point-to-point delivery Publish-subscribe delivery Exactly one consumer gets each message Every active subscriber gets each message Message stays until a consume...

Read full answer

2. What is the difference between ActiveMQ and Kafka?

ActiveMQ is a traditional JMS-compliant message broker built for flexible routing (queues, topics, virtual destinations) and enterprise integration patterns. Kafka is a distributed, log-based streaming platform built for very high-throughput, ordered, replayable event streams. ActiveMQ typically ...

Read full answer

3. Why do we use persistent messages in ActiveMQ?

Persistent messages are written to the broker's storage (KahaDB, JDBC, etc.) before delivery is confirmed, so a message survives a broker crash or restart. Without persistence, an in-flight message living only in memory is lost the moment the broker goes down. Persistent delivery costs some throu...

Read full answer

4. How does message acknowledgment work in ActiveMQ?

When a consumer receives a message, the broker marks it as dispatched but keeps it in its store until an acknowledgment arrives, rather than deleting it right away. sequenceDiagram Producer->>Broker: send(message) Broker->>Consumer: dispatch(message) Consumer->>Broker: acknowledge() Broker->>Brok...

Read full answer

5. When should you use a Durable Subscriber over a plain consumer?

Use a durable subscriber when the receiver is a Topic subscriber that must never miss messages published while it's offline - for example, an audit trail, a billing reconciliation job, or a cache-warming service that must reflect every event even after a restart or network blip. A plain, non-dura...

Read full answer

6. What happens when a consumer fails to acknowledge a message?

If a consumer disconnects, crashes, or times out without sending an acknowledgment (in CLIENT_ACKNOWLEDGE or transacted mode), ActiveMQ treats the message as still pending and redelivers it - either to the same consumer on reconnect or to another available consumer on the same queue. Each redeliv...

Read full answer

7. How is message ordering guaranteed in ActiveMQ?

Within a single Queue with a single active consumer, ActiveMQ preserves the order messages were sent in - FIFO delivery is the default behavior. As soon as multiple consumers listen on the same queue, ActiveMQ load-balances messages across them, so strict global ordering across consumers is no lo...

Read full answer

8. What is the difference between AUTO_ACKNOWLEDGE and CLIENT_ACKNOWLEDGE?

These two modes differ in who triggers the acknowledgment and how much control the application has over it. Mode Trigger Risk / Benefit AUTO_ACKNOWLEDGE Right after receive()/onMessage() returns Simple, but can lose messages if processing fails after the ack is already sent CLIENT_ACKNOWLEDGE Exp...

Read full answer

9. Why should you enable producer flow control?

Producer flow control stops a fast producer from overwhelming the broker or a slow consumer when memory or storage limits on a destination are close to being hit. Instead of letting the broker's memory fill up and eventually error out or crash, ActiveMQ can pause the producer's send() call until ...

Read full answer

10. How do you configure a Dead Letter Queue policy?

Redelivery attempts and DLQ routing are configured together in activemq.xml :

Read full answer

11. When would you choose Virtual Topics over regular Topics?

Choose Virtual Topics when multiple independent consumer groups each need to reliably receive every message, with the durability and load-balancing guarantees of a Queue, without configuring true durable subscriptions for every group. Each consumer group listens on its own Consumer..Virtual...

Read full answer

12. What is the difference between ActiveMQ Classic and ActiveMQ Artemis?

ActiveMQ Classic (5.x) is the original, mature JMS broker with KahaDB persistence. Artemis is a newer broker built on the HornetQ codebase donated to Apache, using an asynchronous journal-based storage model and a native Core protocol, while still supporting OpenWire, AMQP, MQTT, and STOMP for co...

Read full answer

13. How can you optimize ActiveMQ broker performance?

Several concrete levers help ActiveMQ handle more load without adding hardware: Lower the consumer prefetch limit for slow consumers so one client can't hoard a large batch of messages. Use asyncSend for messages that don't need a synchronous broker round-trip. Prefer KahaDB over JDBC persistence...

Read full answer

14. What is the difference between point-to-point and publish-subscribe messaging?

Point-to-point delivers each message to a single consumer pulled from a shared pool, well suited for distributing units of work like image-resize jobs across a worker fleet. Publish-subscribe delivers each message to every interested subscriber, well suited for notifying multiple unrelated system...

Read full answer

15. How do you troubleshoot slow consumers in ActiveMQ?

Start with the web console or JMX to check the queue's pending message count and consumer count - a steadily growing backlog with an active consumer usually means the consumer's processing logic, not the broker, is the bottleneck. Check the prefetch limit : a high prefetch can let one consumer ho...

Read full answer

«
»

Comments & Discussions