# com.bea.control
JMSControl Interface

public interface JMSControl
extends XMLControl

Simplifies access to the Java Message Service. Use this control to send and receive JMS messages. Incoming messages are delivered asynchronously through callbacks.
By default, JMS controls you add to your application will provide an interface that includes built-in and customizable members. You use the customizable members to send or publish messages, and to receive messages through callback handlers.
For more information about using the EJB control, see JMS Control.

All Superinterfaces
  `Control`, `Serializable`,

All Known Subinterfaces
  `JMSControl`

## Field Summary

`public static final `String`` | `HEADER_CORRELATIONID` Indicates the JMSCorrelationID message header.
`public static final `String`` | `HEADER_DELIVERYMODE` Indicates the JMSDeliveryMode message header.
`public static final `String`` | `HEADER_EXPIRATION` Indicates the JMSExpiration message header.
`public static final `String`` | `HEADER_MESSAGEID` Indicates the JMSMessageID message header.
`public static final `String`` | `HEADER_PRIORITY` Indicates the JMSPriority message header.
`public static final `String`` | `HEADER_REDELIVERED` Indicates the JMSRedelivered message header.
`public static final `String`` | `HEADER_TIMESTAMP` Indicates the JMSTimestamp message header.
`public static final `String`` | `HEADER_TYPE` Indicates the JMSType message header.

## Method Summary

`public `Map`` | `getHeaders`() Gets the JMS headers of the last message received.
`public `Map`` | `getProperties`() Gets the JMS properties of the last message received.
`public `Session`` | `getSession`() Returns the JMS session used by `this` control.
`public void` | `setHeaders`(`Map` headers) Sets the JMS headers to be assigned to the next JMS message sent.
`public void` | `setProperties`(`Map` properties) Sets the JMS properties to be assigned to the next JMS message sent.
`public void` | `subscribe`() Indicates that this control is now interested in receiving incoming messages published to the topic.
`public void` | `unsubscribe`() Indicates that this control is no longer interested in receiving incoming messages published to the topic.

## Field Detail

### HEADER_CORRELATIONID

    public static final String HEADER_CORRELATIONID

  Indicates the JMSCorrelationID message header. Use with the getHeaders and setHeaders methods.

Related Topics

``JMSControl.getHeaders()``
``JMSControl.setHeaders(Map)``

### HEADER_DELIVERYMODE

    public static final String HEADER_DELIVERYMODE

  Indicates the JMSDeliveryMode message header. Use with the getHeaders and setHeaders methods.

Related Topics

``JMSControl.getHeaders()``
``JMSControl.setHeaders(Map)``

### HEADER_EXPIRATION

    public static final String HEADER_EXPIRATION

  Indicates the JMSExpiration message header. Use with the getHeaders and setHeaders methods.

Related Topics

``JMSControl.getHeaders()``
``JMSControl.setHeaders(Map)``

### HEADER_MESSAGEID

    public static final String HEADER_MESSAGEID

  Indicates the JMSMessageID message header. Use with the getHeaders and setHeaders methods.

Related Topics

``JMSControl.getHeaders()``
``JMSControl.setHeaders(Map)``

### HEADER_PRIORITY

    public static final String HEADER_PRIORITY

  Indicates the JMSPriority message header. Use with the getHeaders and setHeaders methods.

Related Topics

``JMSControl.getHeaders()``
``JMSControl.setHeaders(Map)``

### HEADER_REDELIVERED

    public static final String HEADER_REDELIVERED

  Indicates the JMSRedelivered message header. Use with the getHeaders and setHeaders methods.

Related Topics

``JMSControl.getHeaders()``
``JMSControl.setHeaders(Map)``

### HEADER_TIMESTAMP

    public static final String HEADER_TIMESTAMP

  Indicates the JMSTimestamp message header. Use with the getHeaders and setHeaders methods.

Related Topics

``JMSControl.getHeaders()``
``JMSControl.setHeaders(Map)``

### HEADER_TYPE

    public static final String HEADER_TYPE

  Indicates the JMSType message header. Use with the getHeaders and setHeaders methods.

Related Topics

``JMSControl.getHeaders()``
``JMSControl.setHeaders(Map)``

## Method Detail

### getHeaders() Method

    public Map getHeaders()

Gets the JMS headers of the last message received. If no message has been received then `null` is returned. The return value maps header names (Strings) to header values.

#### Returns

The headers of the last message received; `null` if no message has been received.

### getProperties() Method

    public Map getProperties()

Gets the JMS properties of the last message received. If no message has been received then `null` is returned. The return value maps property names (Strings) to property values.

#### Returns

The properties of the last message received; `null` if no message has been received.

### getSession() Method

    public Session getSession()

Returns the JMS session used by `this` control.

#### Returns

The session object.

### setHeaders(Map) Method

    public void setHeaders(Map headers)

Sets the JMS headers to be assigned to the next JMS message sent. Note that these headers are set only on the next message, subsequent messages will not get these headers. Also note that if the next message is sent through a publish method, then any header set through this map will override headers set in the message itself.

#### Parameters

headers
  A map of header names (Strings) to header values.

### setProperties(Map) Method

    public void setProperties(Map properties)

Sets the JMS properties to be assigned to the next JMS message sent. Note that these properties are set only on the next message, subsequent messages will not get these properties. Also note that if the next message is sent through a publish method, then any property set through this map will override properties set in the message itself.

#### Parameters

properties
  A map of property names (Strings) to property values.

### subscribe() Method

    public void subscribe()

Indicates that this control is now interested in receiving incoming messages published to the topic. Note that when the control is first created it will not receive messages on the topic until it is explicitly requested so.
Also note that this method applies only to controls which listen to topics. Invoking this method on a control that does not listen on a topic has no effect.

### unsubscribe() Method

    public void unsubscribe()

Indicates that this control is no longer interested in receiving incoming messages published to the topic. This method cancels a subscription previously registered by `JMSControl.subscribe()```.
Note that this method applies only to controls which listen to topics. Invoking this method on a control that does not listen on a topic has no effect.