Message Selectors sql 92
来源:互联网 发布:c 并发编程实战 编辑:程序博客网 时间:2024/04/28 01:23
http://romanykultury.info/044.html
Message Selectors
Message selectors are strings that conform to the standard ANSI SQL-92 syntax (found athttp://www.ansi.org) after theWHERE criterion, and are used by JMS clients for filtering the messages delivered to them. They are evaluated using JMS properties and standard headers and can be specified using both standard and application-specific properties. Message selectors are specified when the message consumer is created. However, because the provider handles the filtering, the client itself is more efficient, and the messaging traffic imposes less bandwidth use.
The interface javax.jms.QueueSession defines a method to create a queue receiver with a specified message selector:
public QueueReceiver createReceiver(Queue queue, String selector) throws JMSException, InvalidDestinationException, InvalidSelectorException
The interface javax.jms.QueueSession defines a method to create a queue receiver with a specified message selector:
public TopicSubscriber createSubscriber(Topic topic, String selector, boolean noLocal) throws JMSException, InvalidDestinationException, InvalidSelectorException
Example Selectors
This section explains a few examples for JMS message selectors. For a more in depth look at message selectors please refer to Appendix B.
A message consumer with the message selector below will be delivered only those messages having a string property namedmanager with the value as Vialli:
manager = 'Vialli'
A message consumer with the message selector below will be delivered only those messages having a string property namedgender with the value as M AND a numeric property named salary with a value greater than 100:
gender = 'M' AND salary > 100
A message consumer with the message selector below will be delivered only those messages having a string property namedgender with the value as M OR a numeric property named salary with a value greater than 100:
gender = 'M' OR salary > 100
A message consumer with the message selector below will be delivered only those messages having a string property namedname with the value as either all or Dick:
name in ('all', 'Dick')
A message consumer with the message selector below will be delivered only those messages having a string property namedname with values not starting with the letter J:
name NOT LIKE 'J%'
A message consumer with the message selector below will be delivered only those messages having theJMSType header set to the string XYZ:
JMSType = 'XYZ'Note
JMS message selectors support all the ANSI SQL-92 compliant combinations. Please refer to an ANSI SQL reference for an exhaustive list.
APPENDIX B
Message Selector Syntax
A message selector is a Stringcontaining an expression that, if it evaluates to TRUE, will result in messages being selected, or if FALSE results in messages being neglected. The syntax of the JMS selector expression is based on a subset of SQL92. The order of evaluation of a message selector is from left to right within precedence level; but parentheses can be used to alter the evaluation order. For consistency, predefined selector literals and operator names are shown in upper case below (but are nevertheless case-insensitive).
A selector can contain tokens, operators, and expressions conforming to the rules outlined hereunder.
Literals
A string literal is enclosed in single quotes. If a string literal is to contain an included single quote, it can be represented by a doubled single quote: for example, 'its' and 'it''s'. As with JavaString literals, the Unicode character encoding is presumed.
An exact numeric literal is a numeric value without a decimal point, such as 59, -257, +82, etc. Numbers in the range of Javalong are supported. Exact numeric literals use the Java integer literal syntax.
An approximate numeric literal is a numeric value in scientific notation, such as 7E4, -27.9E2 or a numeric value with a decimal such as 7., -95.7, +16.2; numbers in the range of Javadouble are supported. Approximate literals use the Java floating point literal syntax.
A boolean literal can have a value of TRUE or FALSE.
Identifiers
Identifiers can be either header field references or property references. An identifier is a character sequence that begins with a Java-identifier start character and is followed by characters that are Java-identifier part characters. An identifier start character is any character for which the method Character.isJavaIdentifierStart() returns true. This includes underscore and$. An identifier part character is any character for which the methodCharacter.isJavaIdentifierPart() returns true.
Identifiers cannot be NULL,TRUE,nor FALSE.
Identifiers cannot be NOT, AND, OR, BETWEEN, LIKE, IN, norIS.
Identifiers are case-sensitive.
Message header field references are restricted to JMSDeliveryMode, JMSPriority, JMSMessageID, JMSTimestamp, JMSCorrelationID, andJMSType.
JMSMessageID, JMSCorrelationID, andJMSType values may be null and if so are treated as a NULL value.
Any name beginning with 'JMSX' is a JMS-defined property name.
Any name beginning with 'JMS_' is a provider-specific property name.
Any name that does not begin with 'JMS' is an application-specific property name. If a non-existent property is referenced, its value is NULL. If it does exist, its value is the corresponding property value.
Whitespace is the same as that defined for Java: space, horizontal tab, form feed and/or line terminator.
Expressions
A selector is a conditional expression. Any selector that evaluates totrue matches; a selector that evaluates to false or unknown does not match.
Arithmetic expressions are composed of arithmetic operators, identifiers with numeric values, numeric literals and/or other arithmetic expressions.
Conditional expressions are composed of comparison operators, logical operators, identifiers with boolean values, boolean literals, and/or other conditional expressions.
Standard bracketing () for ordering expression evaluation is supported.
Logical operators in precedence order: NOT, AND, OR
Comparison operators: =, >, >=, <, <=, <>
(not equal)
Only like type values can be compared. One exception is that it is valid to compare exact numeric values and approximate numeric values. (The necessary type conversion is conducted according to the rules of Java numeric promotion.) If the comparison of non-like type values is attempted, the selector is always false.
String and Boolean comparisons are restricted to = (equal) and <> (not equal). Two strings are equal if and only ifthey contain the same sequence of characters.
Arithmetic operators in precedence order:
+, - unary
*, / multiplication and division
+, - addition and subtraction
NOTE: Arithmetic operations must use Java numeric promotion.
Comparisons
· arithmetic-expr1[NOT] BETWEEN arithmetic-expr2 and arithmetic-expr3
Example:
age BETWEEN 15 and 19
is equivalent to age >= 15 AND age <= 19
age NOT BETWEEN 15 and 1
9 is equivalent to age < 15 OR age > 19
· identifier[NOT] IN (string-literal1, string-literal2,...), where identifieris aString or NULL value.
Example: Country IN (' UK', 'US', 'France')
is true for 'UK' and false for 'Peru'. It is equivalent to the expression:
(Country = ' UK') OR (Country = ' US') OR (Country = ' France')
Example: Country NOT IN (' UK', 'US', 'France')
is false for 'UK' and true for 'Peru'. It is equivalent to the expression:
NOT ((Country = ' UK') OR (Country = ' US') OR (Country = ' France'))
If identifier in an IN or NOT IN operation is NULL, the value of the operation is unknown.
· identifier[NOT] LIKE pattern-value [ESCAPE escape-character], where identifier has aString value; pattern-valueis a string literal where '_' (underscore) stands for any single character; '%' stands for any sequence of characters (including the empty sequence); and all other characters stand for themselves. The optionalescape-character is a single-character string literal whose character is used to escape the special meaning of the '_' and '%' inpattern-value.
phone LIKE '12%3'
is true for '123' or '12993' and false for '1234'
phone NOT LIKE '12%3'
is false for '123' and '12993' and true for '1234'
word LIKE 'l_se'
is true for 'lose' and false for 'loose'
underscored LIKE '\_%' ESCAPE '\'
is true for '_foo' and false for 'bar'
If identifier in a LIKE or NOT LIKE operation is NULL, the value of the operation is unknown.
· identifierIS NULL tests for a null header field value, or a missing property value.
· identifierIS NOT NULL tests for the existence of a non null header field value or property value.
The following message selector selects messages with a message type ofcar and color of redand weight greater than 3500 lbs:
"JMSType = 'car' AND color = 'red' AND weight > 3500"
Null Values
As noted above, header fields and property values may be NULL. The evaluation of selector expressions containing NULL values is defined by SQL 92 NULL semantics. I.e., SQL treats a NULL value as unknown. Comparison or arithmetic with an unknown value always yields an unknown value. The IS NULL and IS NOT NULL operators convert an unknown header or property value intoTRUE or FALSE values.
Special Considerations
When used in a message selector, JMSDeliveryMode will have the value 'PERSISTENT' or 'NON_PERSISTENT'.
Date and time values should use the standard Java long millis value. When including a date or time literal in a message selector, it should be an integer literal for a millis value. The standard way to produce millis values is to usejava.util.Calendar. Although SQL supports fixed decimal comparison and arithmetic, JMS message selectors do not. (This is the reason for restricting exact numeric literals to non-decimals.)
SQL comments are not supported.
- Message Selectors sql 92
- selectors
- Selectors
- 利用jms 消息选择器 Message Selectors 过滤消息
- TIBCO JMS Message Selectors: How to Filter EMS Messages in TIBCO
- Attribute Selectors
- jQuery Selectors
- Selectors 介绍
- CSS Selectors
- css-selectors
- Selectors文件属性
- Selectors API
- JQuery Selectors
- sql net message from client
- SQL*Net message to client
- SQL*Net message from client
- SQL*Net message from client 等待事件
- message
- stagefright与opencore对比
- MFC 单文档多视图
- Android下Activity的生命周期
- strust if标签判断
- C#编码规范---G版
- Message Selectors sql 92
- 图像增强算法(持续更新中)
- string、wstring、cstring、 char、 tchar、int、dword互转
- 详解GCC的安装
- Powerword.dot问题
- 单片机之KEIL--添加头文件库
- css 清除浮动 兼容IE+, FF
- 详解Android中AsyncTask的使用
- 用PowerDesigner制作数据库升级脚本