Protocols in an RTist model are often binary, meaning that there are two connected ports typed by the protocol. The out-events for one of the ports are the in-events for the other port.
This is expressed by making one of the ports conjugated (denoted by ~). Hence, for a conjugated port the direction of protocol events is swapped so that the out-events can be sent in and the in-events sent out from it.
A binary protocol MyProtocol typing two connected ports p1 and p2. The event that can be sent out from p1 (OutEvent1) can be sent in to p2, and the event that can be sent in to p1 (InEvent1) can be sent out from p2. The port p2 is therefore conjugated to swap the event directions specified in the protocol.
In the above example, it doesn’t matter which of the ports that are conjugated. However, when you are modeling a client-server design, a useful recommendation is to conjugate the server ports rather than the client ports.
Even if the opposite also works, you get two benefits by following this recommendation:
- All events that are sent from the client to the server are out-events, and all events that are sent from the server to the client are in-events. This makes send- and invoke-statements in the client capsule easy to read. Communication in client-server designs is usually initiated by clients rather than the server.
- There are typically more client ports than server ports, so by choosing to conjugate the server ports you save some clicking in the Properties view.
A client-server design with 1 server port and 2 client ports. The client ports are named according to the server to make send- and invoke-statements in the client capsules easy to read.
If you want to change which ports that are conjugated, you also need to swap the directions of all events in the protocol of those ports. RTist provides a handy command for doing this. Select all events in the protocol, right-click and choose the command Change Event Direction. All in-events will become out-events and vice versa.
Start a Conversation with Us
We’re here to help you find the right solutions and support you in achieving your business goals.