URIs and Distributed Queries

Distributed queries may be pipelined or parallelized, or both.

If you are using the parallel query feature of Sybase CEP Engine, a stream will be split into separate "instances" and the addresses of the stream instances will be the same except for a "~" followed by a number, as shown below:

ccl://chili:6789/Stream/StockWS/StockEPSqm/Subq/StockPriceFeed~1
ccl://chili:6789/Stream/StockWS/StockEPSqm/Subq/StockPriceFeed~2
ccl://chili:6789/Stream/StockWS/StockEPSqm/Subq/StockPriceFeed~3

Start with the number 1, and increase by 1 for each additional stream you want to distribute the data across.

An input adapter attempting to write to stream instances in a parallel query must resolve each of these logical URIs into a physical URI by passing that individual logical URI to a resolve_uri() function. This resolves in a separate physical URI for each stream instance, and your adapter splits the data across all of these physical URIs.

An output adapter may subscribe to the individual stream instances (the ones whose names end with "~#", where the "#" represents a positive integer) or the combined stream. If the output adapter specifies the URI without the "~#", the adapter will get the combined output of the stream. If the output adapter specifies the URI with the "~#", then of course the adapter will get the output of just one individual stream instance. Similarly, if an input adapter publishes a row to the stream URI with a "~#", then just that stream instance gets the row; if the adapter publishes to a stream URI without a "~#", then each instance of the stream will get a copy of the row.

If you set the number of project instances to 1, then there will only be one stream instance, and accessing a stream with a name ending with "~1" will not work.

If you are pipelining queries across projects (in other words, sending data from an output stream in one project to an input stream in another project), you need to specify the URIs of the streams when you bind a stream in one project to a stream in another project. For information about binding streams from inside Sybase CEP Studio, see the Sybase CEP Studio Guide .