Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Correlation and Exact Match

You can use one or more exact matches in your pattern. To use an exact match, specify a property and an exact value for that property.

In the following example, only the `order` event with the specified `customerId` property value will be processed.

    order.customerId = "123-ABC-456"

A pattern cannot begin with an exact match; a correlation is required as the first element in the clause.

Note: If the first item in the `then` subclause of the `starts with` clause is one of the following:

    then any one
    then all

Then all events in that sequence must use correlation.

## Example

To illustrate how exact matches are used, consider the following simple example. Orders are placed and processed for shipment, then they sit on the loading bay, waiting for the next delivery truck. If the truck does not pick up the orders within two hours, customer service is alerted.

    define pattern /OrderShipper
    using /Order as order and /orderProcessed as processed and /deliveryvan as van
    with
        order.customerId
        and processed.customerId
        and van.pickupStatus=Ready
    starts with order
    then processed
    then within 2 hours van

The pattern is deployed and the Pattern Matcher service starts listening to the events that are sent to it. It puts sets of events that satisfy all the aspects of the pattern into "buckets." At a certain point in time, it has the following "buckets":

- `order.customerId=123`, `processed.customerId=123`
- `order.customerId=456`, `processed.customerId=456`
- `order.customerId=789`

Then a truck arrives and the loading bay staff enters its status. A `deliveryvan` event is sent with `status=ready`.

The Pattern Matcher updates all of its "buckets" for this pattern accordingly:

- `order.customerId=123`, `processed.customerId=123`, `van.pickupStatus=ready`
- `order.customerId=456`, `processed.customerId=456`, `van.pickupStatus=ready`

The above pattern instances succeed and the success rule function executes for each of the instances.

The bucket that contained only `order.customerId=789` fails, and the failure rule function pattern executes.

You might feel that the incomplete "bucket" with `order.customerId=789` should just wait for its corresponding event, `processed.customerId=789` and be delivered on a later truck. If that is the case you must write a different pattern. This simple example only illustrates how the Pattern Matcher service processes a pattern that contains a correlation and an exact match.

You can specify an exact match in many ways, such as the following:

    a.id = "some string"
    a.id = 10
    a.id = 10.0
    a.id = 0.1d
    a.id = 333333L
    a.id = 333333l
    a.id = false
    a.id = False
    a.id = $param1
    a.id = $date(2009, 12, 25)
    a.id = $dateTime(2009, 12, 25, 9, 48, 37, 0)
    a.id = $javaUtilDate

Parameter values are provided at deploy-time.

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.