concept server in category activemq

This is an excerpt from Manning's book ActiveMQ in Action.
Listing 1.5. Start up the ActiveMQ consumer example
[example]$ ant consumer Buildfile: build.xml init: compile: consumer: [echo] Running consumer against server at $url = tcp://localhost:61616 for subject $subject = TEST.FOO [java] Connecting to URL: tcp://localhost:61616 [java] Consuming queue: TEST.FOO [java] Using a non-durable subscription [java] Running 1 parallel threads [java] [Thread-2] We are about to wait until we consume: 2000 message(s) then we will shutdown
As described in earlier chapters, messaging is all about the decoupling of senders from receivers. Messages are sent by one process to a broker, and messages are received from a broker by a different process in an asynchronous manner. One style of system architecture that can be implemented using JMS is known as request/reply. From a high level, a request/reply scenario involves an application that sends a message (the request) and expects to receive a message in return (the reply). Traditionally, such a system design was implemented using a client-server architecture, with the server and the client communicating in a synchronous manner across a network transport (TCP, UDP, and so on). This style of architecture certainly has scalability limitations, and it’s difficult to distribute it further. That’s where messaging enters the picture—to provide the ability to design a system that can easily scale much further via a messaging-based request/reply design. Some of the most scalable systems in the world are implemented using asynchronous processing like that being demonstrated in this example.
Starting the server is rather obvious: create an instance of it and call the start() method. All of the server functionality is housed in the main method, as shown in the following listing.
Listing 7.16. Starting the server for the request-reply example
... public static void main(String[] args) throws Exception { Server server = new Server(); server.start(); System.out.println(); System.out.println("Press any key to stop the server"); System.out.println(); System.in.read(); server.stop(); } ...