The Sender selector ascertains conditional flow of data through a route. By specifying one or more components (as per requirement) on the Sender selector of the selected route, only those messages coming from the specified components will be allowed to pass through the route.
Defining a Sender selector
To provide a Sender property, select the route and go to the Selectors property tab. Click the button against the Sender property and select the component(s) from the list to define the route so as to allow only those messages which come from the particular component to get through.
Example
An example is given below with the corresponding steps explained.
Scenario
Create an Event Process containing two instances of a Chat service and an instance of a Display connected through routes.
In the event process, connect the routes from output ports to input ports as displayed below:
- Chat1 to Display1 - Route1
- Chat2 to Display1 - Route2
- Display1 to Chat1 - Route3
- Display1 to Chat2 - Route4
Figure 1: Event Process as per scenario
In the above connections, when the Event Process is launched and a message is sent from the Chat1 component, it is received by the Display component and the message is sent back to both Chat1 and Chat2 components from the Display output port.
Define conditional data flow from the Display component instance by assuming that Display1 has to send only those messages on Route3 which are sent from Chat1. Similar conditions should also apply to route4 so that it allows only those messages sent from chat2 to Display1.
Steps
Enable Source Context
To start tracking the source context,
- Open General properties for the Event Process.
- Enable the Store Source Context option.
Figure 2: Enabling source context - Click Save icon or press CTRL+S to save the configuration.
Define Conditional Data
To define conditional data flow through route1,
- Select Route3; when the properties of this route is displayed in the Properties tab, go to the Selectors tab.
- In Selectors tab, click the button against Sender property.
In the Senders Dialog box, select chat1 and click OK
Figure 2: Configuring Sender selector on route1
The above steps ensure that only the data sent by Chat1 will travel through route3. Similarly, set the Sender Selector value as 'Chat2' for Route4.
After these changes, when the event process is launched, messages sent by Chat1 are in turn received only by Chat1 and messages sent by Chat2 are received only by Chat2.