Search Results

Content Matchers

Subscriber objects can specify interest in messages based on their content, that is, based on message fields and their values. A content matcher selects a subset of messages from a message stream according to the fields and values in those messages. A subscriber uses a content matcher to express interest in the subset of messages that the content matcher specifies.

Syntax

A content matcher is a JSON object with one or more fieldname:value elements:

{ "fieldname": value }

You can supply a content matcher when creating a durable subscription to filter which messages are delivered to the application, but it is not required.

The value can be a string, long, or the booleans true and false. If the value is a string or long the matcher only matches message fields of type string or long with the specified value. The values must be an exact match, wildcards are not supported. If the value is a boolean, the matcher matches only the message fields that are present in the message (true) or absent from the message (false).

An empty or null matcher {} matches all messages.

Content Matcher Example

Consider the following two TIBCO eFTL messages (the concepts apply to TIBCO FTL® as well):

var msg1 = new eFTLMessage();`
msg1.set('name': 'acme');
msg1.set('cost': 1000);

var msg2 = new eFTLMessage();
msg2.set('name': 'cyberdyne');
msg2.set('cost': 1000);

Example of field type matching

The content matcher { "name": "acme", "cost": 1000 } matches the first message, but not the second. The matcher checks both that the name is equal to acme and that the cost field is 1000.

Example of field presence matching

The content matcher { "cost": true } matches both messages, as it only checks for the presence of the cost field. The value of the field cost does not matter, only whether the field is present or not.