The XMS object model

The XMS API is an object-oriented interface. The XMS object model is based on the JMS 1.1 object model.


Main XMS classes

The main XMS classes, or types of object are as follows:

    ConnectionFactory
    A ConnectionFactory object encapsulates a set of parameters for a connection. An application uses a ConnectionFactory to create a connection. An application can provide the parameters at run time and create a ConnectionFactory object. Alternatively, the connection parameters can be stored in a repository of administered objects. An application can retrieve an object from the repository and create a ConnectionFactory object from it.

    Connection
    A Connection object encapsulates an active connection from an application to a messaging server. An application uses a connection to create sessions.

    Destination
    An application sends messages or receives messages using a Destination object. In the publish/subscribe domain, a Destination object encapsulates a topic and, in the point-to-point domain, a Destination object encapsulates a queue. An application can provide the parameters to create a Destination object at run time. Alternatively, it can create a Destination object from an object definition that is stored in repository of administered objects.

    Session
    A Session object is a single threaded context for sending and receiving messages. An application uses a Session object to create Message, MessageProducer, and MessageConsumer objects.

    Message
    A Message object encapsulates the Message object that an application sends using a MessageProducer object, or receives using a MessageConsumer object.

    MessageProducer
    A MessageProducer object is used by an application to send messages to a destination.

    MessageConsumer
    An MessageConsumer object is used by an application to receive messages sent to a destination.


XMS objects and their relationships

Figure 1 shows the main types of XMS object: ConnectionFactory, Connection, Session, MessageProducer, MessageConsumer, Message, and Destination. An application uses a connection factory to create a connection, and uses a connection to create sessions. The application can then use a session to create messages, message producers, and message consumers. The application uses a message producer to send messages to a destination, and uses a message consumer to receive messages sent to a destination.

Figure 1. XMS objects and their relationships

In XMS .NET, the XMS classes are defined as a set of .NET interfaces. When we are coding XMS .NET applications, we need only the declared interfaces.

The XMS object model is based on the domain independent interfaces that are described in Java Message Service Specification, Version 1.1. Domain-specific classes, such as Topic, TopicPublisher, and TopicSubscriber, are not provided.


Attributes and properties of XMS objects

An XMS object can have attributes and properties, which are characteristics of the object, that are implemented in different ways:

    Attributes
    An object characteristic that is always present and occupies storage, even if the attribute does not have a value. In this respect, an attribute is similar to a field in a fixed-length data structure. A distinguishing feature of attributes is that each attribute has its own methods for setting and getting its value.

    Properties
    A property of an object is present and occupies storage only after its value is set. A property cannot be deleted or its storage recovered after its value is set. We can change its value. XMS provides a set of generic methods for setting and getting property values.

  • Administered objects
    Using administered objects, we can administer the connection settings used by client applications to be administered from a central repository. An application retrieves object definitions from the central repository and uses them to create ConnectionFactory and Destination objects. Using administered objects, we can de-couple applications from the resources that they use at run time.

Parent topic: Developing XMS .NET applications