In a clustered environment, you may have development/test traffic and production traffic mixed together. Without separation, test messages could be processed by production clusters and vice versa. You need controlled load balancing where specific machines handle specific types of messages.
Queue partitioning uses multiple JMS queues (e.g., DevelopmentQueue, ProductionQueue) to route different types of messages to different server clusters. Front-end components analyze the request source and place messages on the appropriate queue, controlling which cluster processes which traffic.
- Set up multiple queues:
DevelopmentQueueandProductionQueue - Front-end (JSP/Servlet/Stateless Session Bean) checks request source (e.g., internal IP)
- Message placed on
DevelopmentQueuefor internal test requests - Message placed on
ProductionQueuefor external real client requests - Back-end: Development cluster MDBs bound to
DevelopmentQueue - Back-end: Production cluster MDBs bound to
ProductionQueue - Each cluster can be tuned independently (size, debugging, behavior)
- Artificial way to achieve controlled load balancing in JMS systems
- Each cluster can be independently scaled based on its queue’s load
- Development MDBs can include debugging statements; production MDBs optimized
- Pre-chooses which machines get which messages (before they reach the queue)
- Separates test and production traffic completely
- Built from: MDB — MDBs consume from specific queues
- Built from: JMS — uses JMS queues for message routing
- Related: Poison Message — poisoning one queue doesn’t affect the other
- Related: Sub — uses Point-to-Point (Queue) model
- Related: Stateless Session Bean — can be the front-end that routes messages
- Requires front-end logic to classify and route messages (additional complexity)
- Queue names must be known at deployment time (configured in MDB deployment)
- If one queue gets all the traffic, that cluster may be overwhelmed while other is idle
- Not true dynamic load balancing — routing decision made before queue insertion