How to send JMS message to a particular subscriber

Hello Team,

I am having a topic which is subscribed by three subscribers now I want to send a JMS message to a particular subscriber, how I can do this?

Thanks and Regards,
Mukesh

You don’t!
The whole point of topics is that the sender does not know who or is even interested in who will be processing the message. You can use filters on the subscriber side to narrow the subscriber so that a single topic can be used for more than target type. However, you should remember to keep filters a simple as possible otherwise it becomes horribly hard to understand the plumbing involved.

I appreciate that my answer maybe frustrating to you as you have a problem to solve. Thus could you explain your use case, that way it may be possible to suggest an alternative where the publisher doesn’t need to know the identity of the subscriber.
regards,
John.

2 Likes

Hi,

As John already mentioned, ideally JMS Selectors are used to filter out messages from the provider, so the subscriber will receive only the interested messages. If you don’t have an option to use JMS selector because of change you need to pass special headers while sending, you could still use the local filter if at all you want to filter out based on the message body.

Thanks

You can research information about the differences between topics and queues. As others have noted, a topic is not for a single destination. But a queue is. If you have a need to send a message to just one target, define and use a queue.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.