Query Features Overview
The query language enables you to make queries using an SQL-like language. Queries are executed in query agents. You can query cache content (requires Cache OM), and you can also query events (event stream processing).
Query Agents
Queries can only be executed by specialized agents called query agents. One engine (node) can have multiple query agents, or a mixture of inference agents and query agents.
Query agents have channels and destinations. They can execute rule functions, but not rules. Query agents have no Rete network for inferencing.
Querying the Cache
When a query agent is deployed as part of a TIBCO BusinessEvents application that uses cache object management, you can query data in the cache.
Query features provide view-only access into the cache. You cannot use query language to do any updates to data in the cache.
It’s important to understand basic cache configuration and the part query agents play in a cache cluster. See chapters on Cache OM in TIBCO BusinessEvents Developer’s Guide.
Querying the Event Stream
Query agents can listen to an event stream. The event stream can consist of messages sent out on a Rendezvous subject, or a JMS topic or queue, or other source that a TIBCO BusinessEvents destination can listen to. Events can also be generated internally and piped straight to a query.
Event stream processing in the query agent is highly performant and can handle very large numbers of incoming messages. The query agent runs continuous (or snapshot) queries against the events.
Continuous queries against the event stream make comparisons across event streams, as if they were tables. Thus, event stream processing can be termed channel-centric computing. This approach is ideal when you need to operate on sets of events (such as for aggregations). This is traditionally associated with financial data feeds, although it might also be used in detecting patterns in streams for smart grid meter feeds, web site monitoring feeds, and so on.
Distilling Data
The query agent can assert events, such that another query (or a locally deployed inference agent) can listen to them. These internally generated events enable you to build several tiers of queries, each aggregating and abstracting the data into ever more interesting information. The distilled data can be sent out through a channel to a TIBCO BusinessEvents application or external application as needed.
See Event Stream Processing (ESP) Queries for details.
- Two Types of Queries—Snapshot and Continuous
Two types of queries are available, snapshot queries and continuous queries. - Summary of Functions Used to Create and Execute Queries
All queries are created and executed using a set of query functions. The query functions are called from rule functions in the query agent. - Query From a Rule (in an Inference Agent)
Queries can only run in a query agent. Rules can only run in an inference agent. In order for a rule to trigger a query to execute, the rule must send an event to the query agent. In order for the query results to be used in a rule, the query agent must send them in an event to an inference agent. - Query as a Pre-filter
Query agents can act as pre-filters and routers. Suppose you want to check for the existence of a concept in the cache, using properties of an event. If the concept does not exist, you want to create it.