@jc:jms-property Annotation

In a JMS control, sets and retrieves properties on the message.

Note: The @jc:jms-property annotation appears in JMS controls with the .jcx extension. JMS controls with the .ctrl extension, which were created in a previous version of WebLogic Workshop, use the @jws:jms-property annotation. Controls with the .ctrl extension continue to be supported in WebLogic Workshop.

Syntax

@jc:jms-property

key="identifierString"

value="propertyValue"

Attributes

key

Required. A string which identifies this property.

value

Required. The property value.

Remarks

The @jc:jms-property annotation specifies a custom property to be appended to an outgoing JMS message or read from an incoming message. You can add this annotation to a method that sends a JMS message to set properties on the message. You can also add it to a callback that receives a JMS message to retrieve the message properties. The property values are passed to the callback's parameters.

Properties are name/value pairs and can be of type boolean, byte, short, int, long, float, double, or string. You can add as many properties as you wish; each property is specified in a separate @jc:jms-property tag.

Examples

The following example demonstrates the use of the @jc:jms-property annotation in a method on a JMS control that sends a message to the message service. Note that the value of the transactionType property is hard-coded as a string, but the value of the accountID property is passed to the method by the client, and that value is substituted to set the property.

/**
 * @jc:jms-property key="accountIdentifier" value="{accountID}"
 * @jc:jms-property key="transactionType" value="DEPOSIT"
 */ 
public void deposit(AccountTransaction transaction, String accountID); 
  

The example below demonstrates use of the @jc:jms-property annotation in the callback that receives a message on the JMS control. The header values are retrieved from the message by the control and passed in to the calback:

/**
* @jc:jms-property key="accountIdentifier" value="{accountID}"
* @jc:jms-property key="transactionType" value="{transactionType}"
**/ 
public void receiveUpdate(
                          // Message body (XMLBean type)
                          AccountTransaction transaction,
                          // Properties
                          String transactionType, 
                          String accountID
                          ); 
    

Related Topics

JMS Control

Specifying Message Headers and Properties

@jc:jms Annotation

@jc:jms-headers Annotation