Skip to content

JMS (Java Message Service) Bindings

The Java Message Service (JMS) is a Java API that allows applications to create, send, receive, and read messages. It provides a common way for Java programs to create portable, message-based applications for the enterprise. The AsyncAPI JMS bindings allow you to describe the configuration of your JMS-based systems in a standardized way.

JMS Protocol Overview

JMS is a specification, not an implementation. It defines a set of interfaces that message-oriented middleware (MOM) vendors implement. This allows for loose coupling between applications and the messaging system.

Key concepts include:

  • Destinations: The objects that applications send messages to and receive messages from. JMS defines two types:
    • Queues (Point-to-Point): Each message has only one consumer.
    • Topics (Publish/Subscribe): Each message can have multiple subscribers.
  • ConnectionFactory: An object that encapsulates connection configuration information, which a client uses to create a connection to a JMS provider.
  • Messages: Composed of headers (metadata), properties (application-specific), and a body (the payload).
  • Producers & Consumers: Clients that send messages to and receive messages from destinations.

AsyncAPI JMS Bindings

The JMS bindings provide a way to map AsyncAPI concepts to specific JMS provider configurations.

Binding Types

Binding TypePurposeDescription
Channel BindingDestination ConfigurationDefines a channel as a JMS Queue and specifies its properties.
Operation Binding(Placeholder)Reserved for future JMS-specific operation properties.
Message BindingHeader & Property ConfigurationDefines JMS-specific headers (like JMSCorrelationID) and properties for a message.
Server BindingConnection Factory ConfigurationSpecifies the JMS ConnectionFactory class and its properties, including the clientID.

Supported Versions

VersionStatusKey Features
0.0.1LatestProvides initial, comprehensive support for defining JMS destinations, messages, and connection factories.

Core JMS Concepts in AsyncAPI

Destinations and Channels

An AsyncAPI channel maps to a JMS Destination. The channel binding allows you to specify whether the destination is a standard queue or a fifo-queue for providers that support strict ordering.

yaml
channels:
  orderProcessingQueue:
    bindings:
      jms:
        bindingVersion: '0.0.1'
        destination: 'orders'
        destinationType: 'queue'

JMS Headers

The message binding is crucial for defining the standard JMS headers that provide metadata for routing and tracking. This includes headers like JMSMessageID, JMSCorrelationID, and JMSReplyTo, which are essential for implementing patterns like request/reply.

yaml
messages:
  orderRequest:
    bindings:
      jms:
        headers:
          type: object
          properties:
            JMSReplyTo:
              type: string

Connection Factory

The server binding is used to configure the client's entry point to the JMS provider: the ConnectionFactory. You must specify the Java class for the factory and can provide additional provider-specific properties.

yaml
servers:
  activemq:
    url: tcp://broker.example.com:61616
    protocol: jms
    bindings:
      jms:
        bindingVersion: '0.0.1'
        jmsConnectionFactory: 'org.apache.activemq.ActiveMQConnectionFactory'
        clientID: 'my-app-1'

Binding Documentation

Channel Bindings

Operation Bindings

Message Bindings

Server Bindings