Thursday, March 15, 2012

Filtering a subscription trigger

So you want to filter out your subscription trigger so it only triggers on certain events.   There's a filter field in the subscription trigger, but it's just a free-form field.  The documentation isn't clear.

Update - found an easier way.
(%myField%=="myvalue")

Complex filters can look like this:

(%textMessageMonitorEvent/textMessageEnvelope/processType%=="VehicleReady" && %textMessageMonitorEvent/textMessageTrackingInfo/monitorStatus%=="DONE" && %textMessageMonitorEvent/textMessageTrackingInfo/deliveryStatus%<>"SUCCESS")

The below also works, but is harder to read and you have to include the document in the clause.  The above just needs the field path.

%myDoc/myField% L_EQUALS myvalue

Note that there are no quotes on the right operand even though it is a string value!

Also, you need to use the "name" operators like L_EQUALS to have the filter operate on the broker, rather than passing it to the Integration Server and then filtering it (which causes more network traffic and IS CPU usage).

Here are the possible comparators I found in the Developer's handbook.

L_EQUALS
L_NOT_EQUALS
L_LESS_THAN
L_LESS_OR_EQUAL
L_GREATER_THAN
L_GREATER_THAN
L_GREATER_OR_EQUAL
L_GREATER_OR_EQUAL