[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eEventarc Advanced utilizes Common Expression Language (CEL) for evaluating and filtering messages, allowing users to define condition and transformation expressions.\u003c/p\u003e\n"],["\u003cp\u003eCondition expressions in Eventarc Advanced use logical operators like \u003ccode\u003e&&\u003c/code\u003e, \u003ccode\u003e||\u003c/code\u003e, and \u003ccode\u003e!\u003c/code\u003e to compare variables with literal values, such as checking if \u003ccode\u003emessage.type\u003c/code\u003e equals a specific string.\u003c/p\u003e\n"],["\u003cp\u003eEvent context attributes are accessible as variables within a \u003ccode\u003emessage\u003c/code\u003e object, enabling enrollments to express specific attribute rules, for instance \u003ccode\u003emessage.type\u003c/code\u003e to check the event type.\u003c/p\u003e\n"],["\u003cp\u003eString manipulation and regular expression functions are supported in Eventarc Advanced, facilitating tasks like string comparison, substring extraction, and matching patterns using RE2 syntax.\u003c/p\u003e\n"],["\u003cp\u003eEventarc advanced provides functions such as \u003ccode\u003emerge\u003c/code\u003e and \u003ccode\u003eflatten\u003c/code\u003e, which can be used to simplify the transformation of data.\u003c/p\u003e\n"]]],[],null,["# Use Common Expression Language\n\n[Advanced](/eventarc/advanced/docs/overview)\n\n[Common Expression Language (CEL)](https://opensource.google/projects/cel) is an\nopen source non-Turing-complete language that can be used to evaluate\nexpressions. Every enrollment in Eventarc Advanced includes a condition\nexpression written in CEL that is used to evaluate and filter messages. You can\nalso transform your event data content by writing transformation expressions\nusing CEL.\n\nIn general, a condition expression consists of one or more statements that are\njoined by logical operators (`&&`, `||`, or `!`). Each statement expresses an\nattribute-based rule that is applied to the data. Most commonly, operators are\nused to compare the value contained in a variable with a literal value.\n\nFor example, if the value of `message.type` is\n`google.cloud.dataflow.job.v1beta3.statusChanged`, then the expression\n`message.type == \"google.cloud.dataflow.job.v1beta3.statusChanged\"` evaluates to\n`True`.\n\nFor more information, see the following:\n\n- [Create an enrollment to receive events](/eventarc/advanced/docs/receive-events/create-enrollment)\n- [Transform received events](/eventarc/advanced/docs/receive-events/transform-events)\n- [CEL language definition](https://github.com/google/cel-spec/blob/master/doc/langdef.md)\n\nAvailable attributes\n--------------------\n\nAll event context attributes can be accessed as variables through a predefined\n`message` object. These variables are populated with values based on event\ncontext attributes at runtime. An enrollment can use a variable to express a\ngiven attribute. For example, `message.type` returns the value of the `type`\nattribute.\n\nNote the following:\n\n- Events might include, and enrollments can use, any number of additional custom\n [CloudEvents](https://cloudevents.io/) attributes with distinct names (also\n known as\n [extension attributes](https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#extension-context-attributes)).\n However, they are represented as `String` types in CEL expressions regardless of\n their actual format. You can use a CEL expression to cast their values to other\n types.\n\n- You can't evaluate enrollments based on the event payload content. Both\n `message.data` and `message.data_base64` are reserved variables and can't be\n used in expressions. However, CEL is supported when\n [transforming event data](/eventarc/advanced/docs/receive-events/transform-events)\n which lets you modify the event payload content (for example, to satisfy the\n API contract for a specific destination).\n\nThe following attributes can be accessed when evaluating condition expressions\nfor an enrollment:\n\n\u003cbr /\u003e\n\nOperators and functions\n-----------------------\n\nYou can use operators and functions to build complex logic expressions.\n\nLogical operators, such as `&&`, `||,` and `!`, let you verify multiple\nvariables in a conditional expression. For example,\n`message.time.getFullYear() \u003c 2020 && message.type == \"google.cloud.dataflow.job.v1beta3.statusChanged\"`\njoins two statements, and requires both statements to be `True` to produce an\noverall result of `True`.\n| **Note:** A distinction is made between an attribute that is not set versus an attribute with an empty value. You can use the `has` macro to test for a field's existence. For example, `has(message.bucket)` returns `True` if the extension attribute `bucket` is set. If an attribute isn't set, any logical operations using it always evaluate to `False` regardless of the literal value.\n\nString manipulation operators, such as `x.contains('y')`, match strings or\nsubstrings that you define, and let you develop rules to match messages without\nlisting every possible combination.\n\nEventarc Advanced also supports extension functions, such as\n`merge` and `flatten`, which can be used to transform data and simplify the\nmodification of events received from a bus.\n\nSee the list of\n[CEL predefined operators and functions](https://github.com/google/cel-spec/blob/master/doc/langdef.md#standard-definitions)\nand\n[CEL predefined macros](https://github.com/google/cel-spec/blob/master/doc/langdef.md#macros).\n\n### Logical operators\n\nThe following table describes the logical operators that Eventarc Advanced\nsupports.\n\n### String manipulation operators\n\nThe following table describes the string manipulation operators that\nEventarc Advanced supports.\n\n### Regular expression functions\n\nThe following table describes the regular expression functions that\nEventarc Advanced supports.\n\nThe regular expressions follow the\n[RE2 syntax](https://github.com/google/re2/wiki/Syntax). Note that the\n`R` preceding the regular expressions indicates a raw string that doesn't\nrequire escaping.\n\n### Extension functions\n\nEventarc Advanced supports certain extension functions that can\nbe used to transform the event data received through a bus. For more information\nand examples, see\n[Transform received events](/eventarc/advanced/docs/receive-events/transform-events#transform-functions).\n\nWhat's next\n-----------\n\n- [Transformation examples](/eventarc/advanced/docs/receive-events/transformation-examples)"]]