jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes MDB using a message selector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "MDB using a message selector" Watch "MDB using a message selector" New topic

MDB using a message selector

Rusty Nell

Joined: Jun 13, 2008
Posts: 3
Running Weblogic 10.0 servers in a clustered environment, is there a way to create a uniform deployment where the MDB on each server instance in the cluster could use a message selector that only picked up messages from a shared queue that are destined for that specific server instance?

It's a weird case, 99% of the messages can be picked up by any server in the cluster, but 1% of them need to be processed by a specific instance. I would like to have one MDB read blindly, and if it receives a message marked for a specific instance, it would place it into a different queue where a second MDB could pick it up based on message selector.

This keeps my performance up on the 99% of the cases and puts the penalty on the 1%. This use case is a request-response pair of messages. Most the time the server is stateless and any instance can correlate the response, but in 1% of the cases, a specific server instance is expecting the response to be applied to an object it is holding in a memory cache to make the asynchronous service call look like a synchronous call to the service client.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

"Rusty Nail", please check your private messages for an important administrative matter.

[Asking smart questions] [About Bear] [Books by Bear]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

"Rusty Nell",
Please check your private messages, again.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Amit M Tank
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
you can solve this problem in a diff manner, the messages which you want to be picked up by one server instance could be posted on a different queue and only the specific server should listen to that queue.

Amit Tank
Linked In
Rusty Nell

Joined: Jun 13, 2008
Posts: 3
The issues I would like to avoid are:

1) different deployment per server instance in the cluster
2) a need to know anything about the other deployed server instances.
3) proliferation of queues

To solve #1 the server would need to use a message selector or locate a queue based on something from it's environment. The deployed artifact (ear file) should be deployed to the entire cluster.

To solve #2 the message originator would not know anything about the deployment details of the cluster, it would just know of a single queue to direct all messages to. When a message is received, servers would need to dump all unwanted messages to a 'not my message' queue.

To solve #3 there would be one queue where all inbound messages are received and a second where messages with specific routing would be placed. That makes a total of two distributed queues, instead of one queue per server instance.

My goal is to place the burden of getting the correct messages on the consumer, leaving the message provider agnostic of the consumer deployment details.

I agree. Here's the link: http://aspose.com/file-tools
subject: MDB using a message selector
It's not a secret anymore!