0
votes

I know I might sounds ridiculous for some experts, however, it's been in my head for quite a while and still no concrete answer found.

In PUBLISH/SUBSCRIBE MESSAGING WITH JMS TOPICS: JMS publisher sends a msg to JMS provider, and JMS provider sends the msg to JMS subscribers and receives their acknowledgement.

Is it possible that I can somehow modify the JMS provider, so that the JMS producer only sends out every other message it receives from JMS publisher?

Totally newbie in this field, so any suggestion is welcomed.

3
(a) I am terribly sorry for the confusion, TMS->JMS. (b) Actually I need a central buffer (similar to the position of JMS provider): the central buffer receives msg from publisher, and buffer 3 of them, and then send all 3 to the subscriber; and for another subscriber, buffer 10 msg, and then send all 10 to this subscriber. In this way, subscriber don't need to count the msg itself.Lily

3 Answers

1
votes

If what you want is for the subscriber to be able to configure to receive messages in batches, where each subscriber can have a different batch size, then JMS will not provide this functionality. This is not a typical pubsub type scenario.

If you want to accomplish this, I would suggest you add some custom buffering on your subscriber side that will queue up the incoming messages and then do a batch notify when your queue is full. This could then be easily configured on a per subscriber basis.

The only messaging system that I know provides a similar functionality is pubsub in XMPP, but even then the batches are determined by a timed interval instead of number.

0
votes

You could look at filtering at your JMS subscriptions using JMS API Message Selectors. You can then only read/process messages that match a certain criteria.

With more information about what you are trying to accomplish (filtering? testing dropped messages? load balancing? something else entirely?) you might get a better answer.

0
votes

Why would you want to do this? Would it not defeat the whole gambit of messaging, which is not to lose any messages? Or is it that you want to control exactly how the message gets distributed to subscribers? Even this would go against the basic JMS specifications.