Routing was introduced in version 2.1 and enables multiple JMS servers to cooperate in a network. Each server (broker) can forward messages to any number of other brokers, which can in turn forward to yet other broker, etc. This allows advanced applications to create messaging systems that are more scalable, have better performance and greater flexibility. This chapter provides a high level introduction to routing in Novell exteNd Messaging Platform JMS.
The concept of routing is well known from the IP and mail messaging stacks. Rather than sending a message directly from the sender to the receiver, a message may go through a number of intermediaries. Routing is really just an extension of the idea of introducing a single message server between producer and consumer applications. Routing introduces the following benefits:
To get a feel for the benefits of routing, consider the four basic kinds of network topologies in Figure 1 below. To introduce a bit of terminology, we use the term "down-stream" to mean all nodes reachable from a particular node. As an example, c13 and c14 are down-stream from both c11 and c12 in the fan-out graph. In a similar fashion, "up-stream" is used to denote all the nodes that could be sources of messages for a particular node.
Figure 1: Basic network topologies.
These topologies each offer a specific kind of benefit:
JMS supports routing by allowing each server to have any number of routing target brokers. The target brokers are specified using host/port as was the case for clustering. Also similar to clustering, message forwarding is different for queues and topics:
There is no automatic synchronization of destinations between message brokers that are networked together. If a destination is created on one broker, which routes messages to a second broker, the destination in question will not automatically be created on the second broker. If a topic message should reach a broker which doesn't hosts the destination for which the message is intended, the message will simply be discarded. However, if a queue message can not be forwarded, it will be stored in a special error queue, if such a queue has been set up administratively.
The above strategy provides the same semantics for queues and topics as in a single server system. Topic subscribers will receive all messages sent to a topic after the subscription was first made. Queue receivers will receive un-consumed messages from a queue in round-robin fashion. The only difference is that consumers can receive messages from a different server than the message was originally sent to.
The local/remote broker is a very common configuration. This configuration can in particular be used with the HTTP transport to for instance allow a laptop to shift messages across to a remote broker by using the Internet. Figure 2 below shows such a configuration:
Figure 2: Local/Remote broker in Novell exteNd Messaging Platform JMS.
The message producer uses a local broker, which in this case is configured to use a file store ("light" message server). The local broker in turn routes to a remote broker using HTTP(S), i.e. the messages go out on the Internet. On the remote end, the ORB's HTTP Tunnel receives incoming HTTP traffic and forwards it to the remote broker.
Routing is configured using the following properties from the JMQMessageService interface:
msgsvc.router.targets
- A comma separated list of URL's for
other brokers that this broker should forward messages to.
Example:
godel:53506, escher:53506
msgsvc.router.topics
- A comma separated list of topics for
which messages will be routed to other brokers. This is typically used to
limit the amount of messages that get routed. Example:
topic0, topic1
msgsvc.error.queue
- A queue where local error messages will be
stored. If a message broker receives a routed message designed for a queue
which is not bound to this broker, and this broker has no other routing
destinations or cluster memebers to forward the message to, said message
will be stored in this error queue. If no error queue is specified, the
message will be silently discarded. If the queue which is named by this
property doesn't exist it will be created automatically.
These properties are part of the msgsvc.properties
file used by the
JMS server program jmqserv.