Multicast Messaging: Multicast is a messaging model that allows the EMS server to send messages to multiple consumers simultaneously by broadcasting them over an existing network.
Overview: Multicast is a messaging model that broadcasts messages to many consumers at once, as opposed to sending copies of a message to each subscribing consumer individually.
The server sends multicast messages over a multicast channel. Each multicast-enabled topic is associated with a channel. The channel determines the multicast port and multicast group address to which the server sends messages.
The multicast message is received by a multicast daemon running on the same computer with the message consumer.
When an EMS client subscribes to a multicast-enabled topic, it automatically connects to the multicast daemon. The multicast daemon begins listening on the channel associated with that topic, receives any broadcast messages, and delivers them to subscribed clients.
When to use Multicast: Because multicast reduces the number of operations performed by the server and
reduces the amount of bandwidth used in the publish-and-subscribe model, multicast is highly scalable.
Where publish and subscribe messaging creates a copy of a published message for each message consumer, multicast broadcasts the message only once.
Features
Multicast is highly scalable
Multicast reduces the amount of bandwidth consumed
Multicast reduces the number of operations performed by the server
Multicast broadcasts the message only once, where as in case of publish and subscribe for each of the consumer a copy of the message is getting published
Facts
Multicast does not guarantee message delivery
Messages requiring a high degree of reliability should not use multicast
Multicast offers last-hop delivery only; it cannot be used to send messages between servers.
Multicast should not be used in applications where security is a priority
Multicast Messaging Example:
Multicast channels can only be configured statically by modifying the configuration files. There are no commands in the administration tool to configure multicast channels.
Step 1: Enable the EMS Server for Multicast
To enable multicast in the server, set the multicast property to enabled in the tibemsd.conf configuration file:
multicast = enabled
Step2: Create a Multicast Channel
The EMS server broadcasts messages to consumers over multicast channels. Each channel has a defined multicast address and port. Messages published to a multicast-enabled topic are sent by the server and received by the subscribers on these multicast channels.
To create a multicast channel, add the following definition to the multicast channels configuration file, channels.conf:
[multicast-1]
address=234.5.6.7:1
Start the EMS Server.
Step3: Create a topic with Multicast enabled
To create a multicast-enabled topic, use the administration tool to issue the following command:
> create topic testtopic channel=multicast-1
then execute the show topic command to verify multicast is enabled or not
>show topics
the result will be like …
Topic Name SNFGEIBCTM Subs Durs Msgs Size
testtopic ———+ 0 0 0 0.0 Kb
+ at M means multicast is enabled.
Step 4: Start the Multicast Daemon
go to Start menu, follow the path All Programs > TIBCO > TIBCO EMS 7.0 > Start
EMS Multicast Daemon.
Step5: Start the Subscriber
Execute the tibjmsMsgConsumer client to assign user1 as a subscriber to the multicastTopic topic with a Session acknowledgment mode of NO_ACKNOWLEDGE:
C:\tibco\ems\7.0\samples\java> java tibjmsMsgConsumer –topic testtopic –user user1 –ackmode NOin Administration Console type the below command for cross verification…
>show consumers topic=testtopic
Step6: Start the producer
Setting up a client to publish multicast message is no different from setting up a client to send publish and subscribe messages. Because the topic is enabled for multicast in the EMS server, the message producer does not need to follow any additional steps.
C:\tibco\ems\7.0\samples\java>java tibjmsMsgProducer -topic testtopic -user admin hello
Finally the messages (hello) is displayed in the subscriber’s window.