Skip to Main Content
Java Message Service, 2nd Edition
book

Java Message Service, 2nd Edition

by Mark Richards, Richard Monson-Haefel, David A Chappell
May 2009
Intermediate to advanced content levelIntermediate to advanced
330 pages
10h 34m
English
O'Reilly Media, Inc.
Content preview from Java Message Service, 2nd Edition

Common API

This section covers the common API new to JMS 1.1 that bridges the point-to-point and publish-and-subscribe APIs. The common API interfaces can be used with both queues and topics.

Connection

The Connection is the base interface for the TopicConnection and the QueueConnection, and represents an open TCP/IP socket to the JMS provider. It defines several general-purpose methods used by clients of the messaging system in managing a JMS connection. Among these methods are the getMetaData(), start(), stop(), and close() methods:

public interface Connection {

    public Session createSession(boolean transacted,
           int acknowledgeMode) throws JMSException;
    
    public ExceptionListener getExceptionListener() throws JMSException; 
    public void setExceptionListener(ExceptionListener listener) 
       throws JMSException; 

    public ConnectionMetaData getMetaData() throws JMSException; 

    public String getClientID() throws JMSException;
    public void setClientID(String clientID) throws JMSException; 

    public void start() throws JMSException; 
    public void stop() throws JMSException;
    public void close() throws JMSException;

    public ConnectionConsumer createConnectionConsumer
                                 (Destination destination,
                                 String messageSelector,
                                 ServerSessionPool sessionPool,
                                 int maxMessages)
       throws JMSException;
}

A Connection object represents a physical connection to a JMS provider for either point-to-point (QueueConnection) or publish-and-subscribe (TopicConnection) messaging. A JMS client might choose to create multiple connections from ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reactive Systems in Java

Reactive Systems in Java

Clement Escoffier, Ken Finnigan
Java 8 in Action

Java 8 in Action

Mario Fusco, Alan Mycroft, Raoul-Gabriel Urma
The Well-Grounded Java Developer, Second Edition

The Well-Grounded Java Developer, Second Edition

Benjamin Evans, Martijn Verburg, Jason Clark

Publisher Resources

ISBN: 9780596802264Supplemental ContentErrata Page