Skip to main content
Skip table of contents

Dynamic Sending and Receiving

To communicate dynamically with a message queue means that the information about the queue is not taken from the component diagram, but is provided as input to the JMS adapter at runtime.

Example File (Builder project Add-ons/JMS):

<your example path>\Add-ons\ JMS\uml\simpleDynSendReceive.xml

As opposed to static JMS, a parameter containing the connection details needs to be specified (see Setting the Connection Details).

Sending

The sending of messages to a JMS provider is done by the use of the <<JMSAdapter>>. The figure below illustrates the basic structure of an activity diagram using it.

The message queue needs not to be defined in the component diagram. However, component diagram definitions will serve as a default to the connection info parameter and may be overwritten afterwards by action script.

The JMS connection settings are specified in the call behavior activity Set JMS Session Details.

Figure: Activity Diagram for Sending a JMS Message Dynamically

JMS adapters are able to send messages of type String or of type Blob.

The action Send a JMS Message has the stereotype <<JMSAdapter>> . The <<JMSAdapter>> action can be defined by the help of the Action Wizard.

For sending messages to a JMS provider the following parameters are applicable to the JMS adapter action:

  • a message string of type String or Blob or a message parameter of type JMSStringMessage or JMSBlobMessage (For more details on the JMS Header see chapter JMS Message Header Fields.)
  • a send parameter of type JMSSendParameter (For more details see chapter JMS Send Parameter.)
  • a connection parameter of type JMSConnectionInfo (For more details see chapter JMS Connection Info.)

Receiving

The manual receipt of messages from a JMS provider is done by the use of the <<JMSAdapter>>. The figure below illustrates the basic structure of an activity diagram using it. The JMS connection settings are specified in the call behavior activity Set JMS Session Details

Figure: Activity Diagram for Setting the JMS Connection Details

JMS adapters are able to send messages of type String or of type Blob.

The action Receive a JMS Message has the stereotype <<JMSAdapter>> . The <<JMSAdapter>> action can be defined by the help of the Action Wizard.

For sending messages to a JMS provider the following parameters are applicable to the JMS adapter action:

  • a receive parameter of type JMSReceiveParameter (For more details see chapter JMS Receive Parameter.)
  • a connection parameter of type JMSConnectionInfo (For more details see chapter JMS Connection Info.)

Output can be:

  • a message string of type String or Blob or a message parameter of type JMSStringMessage or JMSBlobMessage (For more details on the JMS Header see chapter JMS Header Fields.)

Setting the Connection Details

In the component diagram, the <<JMSClient>> containing the connection factory name and the initial context factory is specified. It is not required to specify further connection details (e.g. a JMS alias) in the component diagram as they only would be used as default values.

Figure: Component Diagram without JMS Alias

More connection details are specified by action script.

In the example, the parameter queueName specifies the name of the queue, to which the activity sends messages. Connection details such as host, port, protocol, etc. are set in the call behavior action Set JMS Session Details.

Figure: Activity Diagram for Setting the JMS Connection Details

Wanting to open more than one JMS session (e.g. to access multiple queues dynamically), use the attribute name of JMSConnectionInfo to distinct them. On the first use of the <<JMSAdapter>> the Runtime will open a JMS session with the connection details specified. All further <<JMSAdapter>> usages will refer to this session with its particular connection settings, that can not be changed. To open another session (e.g. to access an additional queue) set the divergent session details and assign a divergent name to distinct this session from the first one.

All JMS sessions will be closed on service end.

For more information on the connection details refer to chapter JMS Connection Info.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.