Chapter 11. Java Message Service
The standard Java networking APIs, as well as remote object systems such as RMI and CORBA, operate by default under the assumption of synchronous communications. In other words, if a client makes a request of a remote server (e.g., opens a socket and attempts to read some data from it or makes a remote method call on a remote object), the thread that made the request will block until the response comes back from the server. In some situations, it might be necessary or useful to engage in asynchronous communications (e.g., a client sends a request to the server and then continues doing other work, while the server possibly invokes some kind of callback on the client when the request is complete). This is where the Java Message Service (JMS) comes in.
JMS is an API for performing asynchronous messaging. JMS is principally a client-focused API, in that it provides a standard, portable interface for Java/J2EE clients to interact with native message-oriented middleware (MOM) systems like IBM WebSphere MQ, SonicMQ, and so on. JMS isn’t intended to be a platform for implementing a full messaging system, since it doesn’t provide a service provider interface for all of the internals of a message service implementation. In a sense, JMS plays a role with native messaging systems that is analogous to the role that JDBC plays with relational database systems or the role JNDI plays with naming and directory services. Java clients using JMS to interact with messaging ...
Get Java Enterprise in a Nutshell, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.