You are probably best using a queue (such as ActiveMQ) for this and for the lightweight
requirement, you can use MQTT as the underlying protocol which is extremely lightweight.
See:
http://activemq.apache.org/mqtt.html
http://mqtt.org/
For your scenario:
Your producer A will connect to the queue
Your consumer B will connect to the same queue and listens to a topic (for instance /topic/onlyBisInterested
). It will also subscribe to /topic/everyoneIsInterested
Your consumer C will connect to the queue and listens to /topic/everyoneIsInterested
- Your producer will publish a message to
/topic/everyoneIsInterested
and both B and C will receive this message.
You can play around with the topics a lot. You can have topic matching rules on a wildcard basis, on an exact basis or any combination thereof. There are also levels of hierarchy (such as /a/b/*) that can be setup which will accept (/a/b/c or /a/b/d or anything else).
You can also transfer your data over SSL and use authentication if required and use message persistence and guaranteed delivery in case one/many of your node(s) go down.
I recommend reading the official documentation and deciding if it's good enough for you. There are plenty of other free or commercial queues available, most/all of which will satisfy your requirements since they are very standard.