Hi,
I've added $subject to the ntask component, to give more control onto where
scheduled tasks can be scheduled in a cluster. TaskLocationResolvers are
used in ntask to basically to find a location in the available set of
nodes, given the information about the environment. Earlier we had out of
the box task location resolvers like RandomTaskLocationResolver and
RoundRobinTaskLocationResolver. The new
"org.wso2.carbon.ntask.core.impl.RuleBasedLocationResolver" has the
following configuration to be used tasks-config.xml:-
<defaultLocationResolver>
<locationResolverClass>org.wso2.carbon.ntask.core.impl.RuleBasedLocationResolver</locationResolverClass>
<properties>
<property
name="rule-1">HIVE_TASK,HTTP_SCRIPT*,192.168.1.*</property>
<property name="rule-2">HIVE_TASK,.*,192.168.2.*</property>
<property name="rule-5">.*,.*,.*</property>
</properties>
</defaultLocationResolver>
Basically, here, a rule section contains
[task-type-pattern],[task-name-pattern],[address-pattern], and a specific
task checked if its task type matches the task-type-pattern, then it's task
name to task-name-pattern and then it checks the available nodes' addresses
against address-pattern, and if it finds 1 or many, it selects on of those
addresses in a round robin manner. The property names denotes the sequence
the rules will be evaluated, i.e. rule-1 is checked before rule-2.
With this task location resolver, we can implement scenarios such as
executing tasks in a specific zone at first, then only fail-over to another
zone, if the earlier one is not available. This code has been added to the
4.2.0 branch and also to GitHub.
Cheers,
Anjana.
--
*Anjana Fernando*
Senior Technical Lead
WSO2 Inc. | http://wso2.com
lean . enterprise . middleware
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture