Selector Introduction :
A selector is a dispatch pattern you use to dynamically determine which implementation of a component to invoke at runtime. Like a rule group, a selector has date range entries, selection criteria, and a default destination. You select a destination in a selector the same as your would for a rule group. That is, when a selector is invoked, it selects a destination using the selection criteria and date range entries. A destination could be any service-oriented component.
You can call a selector from any of your service-oriented components. The selector job is to use dynamic information to determine which component should be called to do the work. The set of destination components is also configurable, allowing you to provide additional destinations at runtime. For example, imagine that at the start of the new year you want to switch your application over to a new subsystem for inventory management. A selector allows you to provide two destinations and indicate that the new one takes effect on January 1.
Difference between "Rule Group" and "Selector" :
One major difference between a selector and a rule group is that the destination of a selector can be any service component, while a destination in a rule group can be only a rule set or decision table. In other words, a selector can dynamically re-route a service call to any other component at runtime.
Important point need to concentrate on selectors:
The interface operations of the selector must match all of the interface operations of the destinations. In other words, you may not select a destination that has an interface with a different operation name, input, or output than the selector itself. If you try to use a selector where the operation name does not match, then you get a
For matching the operation of interface we need to use interface maps. To convert from one interface to another by using the interface map as a destination in the selector. Then the selector can invoke the interface map that, in turn, calls the actual service implementation.
Altering existing destinations or adding new destinations:
We can update or modify the destinations of a selector and their corresponding date ranges at runtime without redeploying the original application. Using the WebSphere Process Server administrative console, you can replace an existing service implementation with another one, add a new destination with complete date range information, or remove a destination.
We have three selection criteria to use:
Altering and adding destinations in Admin console:
Suppose that your business environment has evolved and you need to change the default destination for
Modify the existing destination
A selector is a dispatch pattern you use to dynamically determine which implementation of a component to invoke at runtime. Like a rule group, a selector has date range entries, selection criteria, and a default destination. You select a destination in a selector the same as your would for a rule group. That is, when a selector is invoked, it selects a destination using the selection criteria and date range entries. A destination could be any service-oriented component.
You can call a selector from any of your service-oriented components. The selector job is to use dynamic information to determine which component should be called to do the work. The set of destination components is also configurable, allowing you to provide additional destinations at runtime. For example, imagine that at the start of the new year you want to switch your application over to a new subsystem for inventory management. A selector allows you to provide two destinations and indicate that the new one takes effect on January 1.
Difference between "Rule Group" and "Selector" :
One major difference between a selector and a rule group is that the destination of a selector can be any service component, while a destination in a rule group can be only a rule set or decision table. In other words, a selector can dynamically re-route a service call to any other component at runtime.
Important point need to concentrate on selectors:
The interface operations of the selector must match all of the interface operations of the destinations. In other words, you may not select a destination that has an interface with a different operation name, input, or output than the selector itself. If you try to use a selector where the operation name does not match, then you get a
ServiceRuntimeException
saying the operation name cannot be resolved. If the input or output does not match (for example, if the destination interface has a different input name or a different input type), then you get a SelectorException
saying the component does not support the operation. For matching the operation of interface we need to use interface maps. To convert from one interface to another by using the interface map as a destination in the selector. Then the selector can invoke the interface map that, in turn, calls the actual service implementation.
Altering existing destinations or adding new destinations:
We can update or modify the destinations of a selector and their corresponding date ranges at runtime without redeploying the original application. Using the WebSphere Process Server administrative console, you can replace an existing service implementation with another one, add a new destination with complete date range information, or remove a destination.
We have three selection criteria to use:
- Current date
- XPath expression
- Visual snippet or Java expression.
Altering and adding destinations in Admin console:
Suppose that your business environment has evolved and you need to change the default destination for
Selector.
You use the administrative console to alter the default destination of the selector. After you commit the change, you test the Process again. Modify the existing destination
- You can change selector criteria using the administrative console. In the Servers view, right-click the server and select Run administrative console.
- In the Log in page, you have to specify a user name to change anything in the selector, even if you have not enabled security. Type any user name and log in.
- In the navigation section, expand Servers, click Application servers, and then click server1.
- In the server1 editor page, scroll down to the Business Integration section and click the Selectors link
- In the Selectors page, you see all the selectors currently in the system. Click your <Selector>, which is the one that you created earlier:
- Click the <your selector> link. You see the date entry for this selector.
- To modify the selector, click<need to change selector> the link.
- To commit the change, select the check box next to the default selector, and then click Commit. You see a message at the top of the administrative console reminding you to select commit to make the changes take effect.