A connector allows messages to flow from one component to another in a route. Connectors may pass all messages or apply selection criteria based on the message structure or content. There are three types of connectors:
To add a connector to a route, select the appropriate Connector icon on the toolbar, then drag the connector from one component (a communication point, filter, or filter output connector) to another. A blue square is displayed around the component when it is selected. Release the mouse button to create the connection.
While it is possible to create cross-route Conditional and JavaScript connectors, it is not recommended you do so as they are not supported.
To remove a connection between two components, select the connection (changing its appearance to bold), then press the DELETE
key. A dialog asking for confirmation of this action may be displayed. Alternatively, right-click the connector, then click Delete Connection.
Standard Connector
Standard connectors are used to pass messages from one Rhapsody component to another in a route and do not restrict or change the messages passing along them.
Conditional Connector
A Conditional connector is used to route messages selectively based on their structure and/or contents.
Conditional connectors (and JavaScript connectors) must originate from a filter. Messages that do not meet the criteria set by the Conditional connector are routed to the No Match or Error connector on the filter. If neither of these connectors is configured, non-matching messages are routed to the Error Queue, which may be viewed in Management Console.
Refer to Adding a Condition and Testing Conditional Connectors to learn how to add conditions to your route and test them.
If knowledge of a message type or structure is required, a message definition must be applied to the route before conditions can be created. This tells Rhapsody the structure of the messages it is parsing and enables messages to be selectively routed depending on their structure and content.
For example, in the following screenshot, an HL7 version 2.4 ADT^A01
message definition has been applied to the route. The Conditional connector has been configured to pass only ACK^A01
(acknowledgment) messages. ADT^A01
messages contained in this definition are blocked. Additionally, as part of the configuration of the message definition, a property called AcknowledgmentCode
is created and mapped to a specific location in the message. The connector will pass messages only if they are acknowledgment messages containing the string AA
(Acknowledgment Accepted) in the location specified by this property mapping.
If multiple message definitions exist on the route, multiple message types could be identified in the conditions. All specified criteria must be true in order for a message to pass through a Conditional connector.
JavaScript Connector
The JavaScript connector uses a JavaScript expression to make routing decisions for messages reaching the connector. This offers more flexibility than the Conditional connector, but does require some knowledge of JavaScript to implement.
The JavaScript expression entered as the criteria is evaluated by the Rhapsody engine. If True
, the message is passed through the connector. If False
, the message is routed to the No Match connector if it is present, otherwise to the Error connector or Error Queue.
This example is the JavaScript equivalent of the Conditional connector configuration. The full text of the expression is:
input.getField("MSH.MessageType") == "ACK^A01" && input.getProperty("AcknowledgmentCode") == "AA"
A ROMessage object is a read-only message.
Property |
Description |
---|---|
|
A ROMessage (read-only message) object |
The following table describes the JavaScript Connector ROMessageObject properties available on the ROMessage object:
Property |
Description |
---|---|
|
Returns the body of the message as a string |
The text
property is immutable and hence can only be read.
The following table describes the JavaScript Connector ROMessageObject methods available on the ROMessage object:
Method |
Description |
---|---|
|
Extracts the field named in the string argument from the message and returns it (as a string) to the caller. If the field does not exist, a null is returned. The message must be parsable using one of the message definitions attached to the route. |
|
Returns the value of the message property as a string to the caller, or null if the property does not exist on the message. |
|
Returns a string array of error messages that occurred while processing the message. |
|
Returns the body of the message as a string using the supplied character encoding. |
- Refer to JavaScript Object Reference for details on JavaScript and the objects that Rhapsody exposes.
- Refer to Shared JavaScript Libraries for details on how to manage shared JavaScript libraries.