Out-of-process Adapter

An out-of-process adapter must perform several actions to send data to or receive data from the server.

  1. Acquire an "address" (URI) that will uniquely identify a specific stream and tell the communication layer (provided by Sybase CEP) how to find that stream. The address may be hard-coded in your program or passed as a parameter.

  2. Open a connection to the stream. The SDKs provide methods to do this.

  3. Write (or read) the desired data. Typically the write (or read) operation is in a loop; the adapter will keep multiple rows of data. The SDKs provide methods to send and receive rows.

  4. Close the connection.

Out of process adapters communicate with the Sybase CEP Server through the network layer.

Note: If the project (query module) is not running, then the stream won't exist, and the out-of-process adapter won't be able to connect to it.

Subscribing with Filters (Predicates)

If you are subscribing to a stream or master window that has been defined with the FILTERCOLUMNS property, you can append a query to the end of the URI to specify values for those columns in the subscription. With this kind of subscription, you only receive rows that have values in the filter columns that match the values you specify in the query. The format is stream_uri?X-C8-Filter=value1, value2, ..., valueN. The values you specify here are for the columns listed in the FILTERCOLUMNS property of the stream or window definition, and must be in the correct order.

For more information about the FILTERCOLUMNS property, see "Create Stream Statement" and "Create Window Statement" in the Sybase CEP CCL Reference Guide . See the specific SDK references elsewhere in this guide for information about the functions and methods available. Some of the SDKs have convenience functions to append the query string to a URI, while others simply accept a URI with the appended query as the parameter to the function that establishes the subscription.

If you are subscribing to a master window and want to mirror the contents of that window, you'll need to watch for negative messages (tuples) and remove the existing positive message with an ID that matches that of the incoming negative message.

Subscribing with Filter Expressions (Arbitrary Predicates)

You can subscribe to any stream or master window and filter the results, even if the stream or window has not been defined with the FILTERCOLUMNS property. With this kind of subscription, you only receive rows for which the expression you specify in the query evaluates to True. The format is stream_uri?X-C8-FilterExpr=expression, where expression is a standard CCL Boolean scalar expression, such as the following:

ccl://localhost:6789/Stream/..../Foo?X-C8-FilterExpr=Symbol%3dIBM+AND+Price>10

Note that the expression is URL-encoded ("%3d" is a URL-encoded equal sign, for example), which may be handled for you, depending on the SDK call you use.

Also note that you cannot include any of the following in the expression:

However, you can include user-defined scalar functions and the zero-argument variant of GETTIMESTAMP().

You can also combine filters and filter expressions when subscribing to a stream or master window defined with the FILTERCOLUMNS property, as in the following:

ccl://localhost:6789/Stream/..../Foo?X-C8-Filter=NYSE,IBM&X-C8-FilterExpr=Price>10

See the specific SDK references elsewhere in this guide for information about the functions and methods available. Some of the SDKs have convenience functions to append the query string to a URI, while others simply accept a URI with the appended query as the parameter to the function that establishes the subscription.