public class ColumnMatchDataRouter extends AbstractDataRouter implements IDataRouter, org.jumpmind.extension.IBuiltInExtensionPoint
The value can be a constant. In the data router the value of the new data is always represented by a string so all comparisons are done in the format that SymmetricDS transmits.
The column name used for the match is the upper case column name if the current value is being compared. The upper case column name prefixed by OLD_ can be used if the comparison is being done of the old data.
For example, if the column on a table is named STATUS you can specify that you want to router when STATUS=OK by specifying such for the router_expression. If you wanted to route when only the old value for STATUS=OK you would specify OLD_STATUS=OK.
The value can also be one of the following expressions:
REDIRECT_NODE is an instruction to match the specified column to a registrant_external_id on registration_redirect and return the associated registration_node_id in the list of node id to route to. For example, if the 'price' table was being routed to to a region 1 node based on the store_id, the store_id would be the external_id of a node in the registration_redirect table and the router_expression for trigger entry for the 'price' table would be 'store_id=:REDIRECT_NODE' and the router_type would be 'column'.
| Modifier and Type | Class and Description |
|---|---|
static class |
ColumnMatchDataRouter.Expression |
log| Constructor and Description |
|---|
ColumnMatchDataRouter() |
ColumnMatchDataRouter(IConfigurationService configurationService,
ISymmetricDialect symmetricDialect) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List<ColumnMatchDataRouter.Expression> |
getExpressions(Router router,
SimpleRouterContext context)
Cache parsed expressions in the context to minimize the amount of parsing
we have to do when we have lots of throughput.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getRedirectMap(SimpleRouterContext ctx) |
java.util.List<ColumnMatchDataRouter.Expression> |
parse(java.lang.String routerExpression) |
java.util.Set<java.lang.String> |
routeToNodes(SimpleRouterContext routingContext,
DataMetaData dataMetaData,
java.util.Set<Node> nodes,
boolean initialLoad,
boolean initialLoadSelectUsed,
TriggerRouter triggerRouter) |
protected java.util.Set<java.lang.String> |
runExpression(ColumnMatchDataRouter.Expression e,
java.lang.String columnValue,
java.lang.String compareValue,
java.util.Set<Node> nodes,
java.util.Set<java.lang.String> nodeIds,
Node node) |
addNodeId, completeBatch, contextCommitted, getDataAsObject, getDataAsString, getDataMap, getDataObjectMap, getNewDataAsObject, getNewDataAsString, getNullData, getOldDataAsObject, getOldDataAsString, getPkDataAsObject, getPkDataAsString, isConfigurable, testColumnNamesMatchValues, toExternalIds, toNodeIdsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompleteBatch, contextCommitted, isConfigurablepublic ColumnMatchDataRouter()
public ColumnMatchDataRouter(IConfigurationService configurationService, ISymmetricDialect symmetricDialect)
public java.util.Set<java.lang.String> routeToNodes(SimpleRouterContext routingContext, DataMetaData dataMetaData, java.util.Set<Node> nodes, boolean initialLoad, boolean initialLoadSelectUsed, TriggerRouter triggerRouter)
routeToNodes in interface IDataRouterprotected java.util.Set<java.lang.String> runExpression(ColumnMatchDataRouter.Expression e, java.lang.String columnValue, java.lang.String compareValue, java.util.Set<Node> nodes, java.util.Set<java.lang.String> nodeIds, Node node)
protected java.util.List<ColumnMatchDataRouter.Expression> getExpressions(Router router, SimpleRouterContext context)
public java.util.List<ColumnMatchDataRouter.Expression> parse(java.lang.String routerExpression) throws SyntaxParsingException
SyntaxParsingExceptionprotected java.util.Map<java.lang.String,java.lang.String> getRedirectMap(SimpleRouterContext ctx)