From a85fe54bbd387b364681182fbffffd1145074ea5 Mon Sep 17 00:00:00 2001 From: rn509j Date: Tue, 10 Oct 2017 22:58:43 -0400 Subject: adding filter document DMAAP-149 Signed-off-by: rn509j Change-Id: I7b46acb525972fac048062c480825ec21895ae66 --- docs/Filter/Filter.rst | 264 +++++++++++++++++---------------- docs/Installation/Installation.rst | 6 +- docs/message-router/image1.png | Bin 0 -> 38995 bytes docs/message-router/message router.jpg | Bin 38995 -> 0 bytes docs/message-router/message-router.rst | 9 +- 5 files changed, 143 insertions(+), 136 deletions(-) create mode 100644 docs/message-router/image1.png delete mode 100644 docs/message-router/message router.jpg (limited to 'docs') diff --git a/docs/Filter/Filter.rst b/docs/Filter/Filter.rst index b9f8d07..dca8682 100644 --- a/docs/Filter/Filter.rst +++ b/docs/Filter/Filter.rst @@ -1,4 +1,6 @@ -Filter +======= +Filter +======= A filter examine an event and decides if it matches or doesn't. Filters are mainly used in rules to decide if the processing entries should be @@ -27,7 +29,7 @@ format: | } | +-----------------------------------------+ -| This filter matches events in which the field "foo" has value "abc" +- This filter matches events in which the field "foo" has value "abc" and the field "bar" is assigned to some value (as opposed to not being present on the event). Filters are used by the consumers to filter out data and consume only specific set of data which matches the @@ -35,21 +37,21 @@ format: parameter by the consumer in consume request as mentioned below: **http://localhost:8080/DMaaP/dmaaprest/events/DMaaP/consumergroup/mHOeNFY4XiWx4CBa?filter=\\{"class":"Equals", "field":"email", "value":"test@abc.com" }** -| Filters can be applied only on data in JSON format i.e. if applied, +- Filters can be applied only on data in JSON format i.e. if applied, filters will automatically ignore any non-json data. While consuming, request CONTENT\_TYPE is not relevant to filter. All the supported filter can be found below. -`Types of -Filters `__ +Types of Filters +---------------- -| DMaaP Message Router supports all the filters which were supported by +- DMaaP Message Router supports all the filters which were supported by DMaaP Message Router and are mentioned below:- -| **All Alarms:** -| Match all alarms. -| **And:** -| Create a set of filters. This filter matches when all of them matches. +- **All Alarms:** + - Match all alarms. +- **And:** + - Create a set of filters. This filter matches when all of them matches. +-------------+--------------------+------------+---------------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -59,9 +61,9 @@ Filters `__ | | | | | +-------------+--------------------+------------+---------------------+ -| **Assigned:** -| Choose a field from the event to check for assignment. This filter - matches when the field is assigned. +- **Assigned:** + - Choose a field from the event to check for assignment. This filter + matches when the field is assigned. +-------------------+--------------------------------------------------------+------------+-----------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -71,8 +73,8 @@ Filters `__ | emptyIsAssigned | If true, an empty value is considered an assignment. | BOOLEAN | True or False | +-------------------+--------------------------------------------------------+------------+-----------------+ -| **Contains:** -| Check if a search string contains another string. +- **Contains:** + - Check if a search string contains another string. +-------------+---------------------------------------------------+------------+--------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -84,8 +86,8 @@ Filters `__ | | | | | +-------------+---------------------------------------------------+------------+--------------+ -| **EndsWith**: -| Check if a search string ends with another string. +- **EndsWith**: + - Check if a search string ends with another string. +-------------+---------------------------------------------------+------------+--------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -95,8 +97,8 @@ Filters `__ | value | The value to search for. Supports ${} notation. | STRING | Any string | +-------------+---------------------------------------------------+------------+--------------+ -| **Equals:** -| Choose a field from the event and a value to check for equality. +- **Equals:** + - Choose a field from the event and a value to check for equality. +-------------+----------------------------------------------+------------+--------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -106,8 +108,8 @@ Filters `__ | value | The value to match. Supports ${} notation. | STRING | Any string | +-------------+----------------------------------------------+------------+--------------+ -| **FlatironObjectExists** -| Matches when the given object exists in the given Flatiron instance. +- **FlatironObjectExists** + - Matches when the given object exists in the given Flatiron instance. +-------------+---------------------------------------------+------------+--------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -117,9 +119,9 @@ Filters `__ | flatiron | The name of the Flatiron client instance. | STRING | Any string | +-------------+---------------------------------------------+------------+--------------+ -| **IsAging** -| Choose a field to test. This filter matches if the expression is - numeric. +- **IsAging** + - Choose a field to test. This filter matches if the expression is + numeric. +-------------+---------------------------------------------+------------+--------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -127,8 +129,8 @@ Filters `__ | field | The field to test. Supports ${} notation. | STRING | Any string | +-------------+---------------------------------------------+------------+--------------+ -| **IsNumeric** -| Choose a field to test. This filter matches if the expression is +- **IsNumeric** + - Choose a field to test. This filter matches if the expression is numeric. +-------------+---------------------------------------------+------------+--------------+ @@ -137,8 +139,8 @@ Filters `__ | field | The field to test. Supports ${} notation. | STRING | Any string | +-------------+---------------------------------------------+------------+--------------+ -| **MathCondition** -| Choose a field from the event and a value for logical math conditions. +- **MathCondition** + - Choose a field from the event and a value for logical math conditions. +-------------+-------------------------------------------------+------------+-----------------------------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -152,10 +154,10 @@ Filters `__ | | | | | +-------------+-------------------------------------------------+------------+-----------------------------------+ -| **NoAlarms** -| Don't match any alarms. -| **Not** -| Negate the configured filter. +- **NoAlarms** + - Don't match any alarms. +- **Not** + - Negate the configured filter. +-------------+-------------------------+------------+-------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -163,8 +165,8 @@ Filters `__ | filter | The filter to negate. | FILTER | A filter | +-------------+-------------------------+------------+-------------+ -| **NotEqual** -| Choose a field from the event and a value to check for inequality. +- **NotEqual** + - Choose a field from the event and a value to check for inequality. +-------------+----------------------------------------------+------------+--------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -174,9 +176,9 @@ Filters `__ | value | The value to match. Supports ${} notation. | STRING | Any string | +-------------+----------------------------------------------+------------+--------------+ -| **NotOneOf** -| Match when the specified field does not have a value from the given - list. +- **NotOneOf** + - Match when the specified field does not have a value from the given + list. +-------------+---------------------------------------------+------------+---------------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -186,8 +188,8 @@ Filters `__ | values | The matching values. | LIST | A list of strings | +-------------+---------------------------------------------+------------+---------------------+ -| **OneOf** -| Match when the specified field has a value from the given list. +- **OneOf** + - Match when the specified field has a value from the given list. +-------------+---------------------------------------------+------------+---------------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -197,9 +199,9 @@ Filters `__ | values | The matching values. | LIST | A list of strings | +-------------+---------------------------------------------+------------+---------------------+ -| **Or** -| Create a set of filters. This filter matches when any one of them - matches. +- **Or** + - Create a set of filters. This filter matches when any one of them + matches. +-------------+--------------------+------------+---------------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -207,9 +209,9 @@ Filters `__ | filters | Combined Filters | LIST | A list of filters | +-------------+--------------------+------------+---------------------+ -| **RegEx** -| Choose a field from the event to match against the regular expression - you provide. +- **RegEx** + - Choose a field from the event to match against the regular expression + you provide. +-------------+---------------------------------------------------------+------------+--------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -219,8 +221,8 @@ Filters `__ | value | The regular expression (pattern) to match. | STRING | Any string | +-------------+---------------------------------------------------------+------------+--------------+ -| **StartsWith** -| Check if a search string starts with another string. +- **StartsWith** + - Check if a search string starts with another string. +-------------+---------------------------------------------------+------------+--------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -230,9 +232,9 @@ Filters `__ | Value | The value to search for. Supports ${} notation. | STRING | Any string | +-------------+---------------------------------------------------+------------+--------------+ -| **Unassigned** -| Choose a field from the event to check for assignment. This filter - matches when the field is not assigned. +- **Unassigned** + - Choose a field from the event to check for assignment. This filter + matches when the field is not assigned. +-------------------+--------------------------------------------------------+------------+-----------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -242,11 +244,11 @@ Filters `__ | emptyIsAssigned | If true, an empty value is considered an assignment. | BOOLEAN | True or False | +-------------------+--------------------------------------------------------+------------+-----------------+ -| **WithinSecondsFrom** -| This filter matches when the specified epoch time value is within the - given number of seconds from the baseline time value. Both time values - are assumed to be in seconds. If a value is in milliseconds, set - baselineTimeInMillis and/or eventTimeInMillis to true. +- **WithinSecondsFrom** + - This filter matches when the specified epoch time value is within the + given number of seconds from the baseline time value. Both time values + are assumed to be in seconds. If a value is in milliseconds, set + baselineTimeInMillis and/or eventTimeInMillis to true. +------------------------+------------------------------------------------------------+------------+-----------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -262,11 +264,11 @@ Filters `__ | baseline | The baseline time value. Supports ${}. | STRING | Any string | +------------------------+------------------------------------------------------------+------------+-----------------+ -| **WithinTimeFromNow** -| This filter matches when the named field has an epoch time value - within the given number of seconds from the current time. The event's - time value is assumed to be in seconds. If it's in milliseconds, set - eventTimeInMillis to true. +- **WithinTimeFromNow** + - This filter matches when the named field has an epoch time value + within the given number of seconds from the current time. The event's + time value is assumed to be in seconds. If it's in milliseconds, set + eventTimeInMillis to true. +---------------------+---------------------------------------------------------+------------+-----------------+ | **Field** | **Description** | **Type** | **Notes** | @@ -278,24 +280,27 @@ Filters `__ | seconds | The number of seconds. | NUMBER | A number | +---------------------+---------------------------------------------------------+------------+-----------------+ -**Limit:** - -- Limit is the integer value and DMaaP Message Router will consumes - only that set of message which are specified in limit. +- **Limit:** -| Suppose if we set limit=2, then only 2 sets of data will be consumed. -| *Get \ **<>/group/2?limit=4*** -| Let us suppose if -| **No of data available** = 4 -| **Set limit** = 6 -| i.e. limit>no of data -| In this scenario all 4 sets of data will be consumed. + - Limit is the integer value and DMaaP Message Router will consumes + only that set of message which are specified in limit. + + .. code:: bash + Suppose if we set limit=2, then only 2 sets of data will be consumed. + *Get \ **<>/group/2?limit=4*** + Let us suppose if + **No of data available** = 4 + **Set limit** = 6 + i.e. limit>no of data + In this scenario all 4 sets of data will be consumed. - If limit is not passed with the url then by default limit is set to 4096. + + .. code:: bash -| i.e. 4096 sets of data will be consumed. -| **Timeout and Long Poll:** + i.e. 4096 sets of data will be consumed. + **Timeout and Long Poll:** - Timeout is the integer value which will be treated by DMaaP Message Router as time in millisecond. @@ -332,8 +337,11 @@ Filters `__ - If meta is set to true then consumer will get the value of message offset along with message. -|image1| -| **Pretty**: + |image1| + + .. |image1| image:: images/image1.png + +- **Pretty**: - Pretty is a Boolean value. @@ -347,55 +355,59 @@ Filters `__ - If pretty is set to true then different sets of messages will be printed in next line separated by comma (,). -|image2| -| **Filter** -| A filter examine an event and decides if it matches or doesn't. -| Filters are mainly used in rules to decide if the processing entries - should be executed on the given event. They're also used for settings, - and systems like the Graph Correlator re-use Highland Park's filter - mechanism to specify which alarms fit in a correlation. -| The standard library includes a number of simple filters. The Equals - filter, for example, compares a field's value with some other value - and returns true if the values match. -| The standard library also includes filter classes called And, Or, and - Not, so you can compose more complex filters. For example, written in - the standard JSON config format: - -+-----------------------------------------+ -| "filter":{ | -| "class":"And", | -| "filters": | -| [ | -| { "class":"Equals", "foo":"abc" }, | -| { "class":"Assigned", "field":"bar" } | -| ] | -| } | -+-----------------------------------------+ - -| This filter matches events in which the field "foo" has value "abc" - and the field "bar" is assigned to some value (as opposed to not being - present on the event). -| Filters are used by the consumers to filter out data and consume only - specific set of data which matches the conditions mentioned in filter. -| Filters can be passed as a query parameter by the consumer in consume - request as mentioned below: -| **http://localhost:8080/DMaaP/dmaaprest/events/DMaaP/consumergroup/mHOeNFY4XiWx4CBa?filter=\\{"class":"Equals", - "field":"email", "value":"`test@abc.com `__" }** -| Filters can be applied only on data in JSON format i.e. if applied, - filters will automatically ignore any non-json data. -| While consuming, request CONTENT\_TYPE is not relevant to filter. - -The MR API allows a subscriber pass a Highland Park filter as part of -the GET request. This will filter the stream of messages sent back to -the subscriber, but for this to work, there are some requirements: - -- The message payload must be JSON - -- Only a filter built from Highland Park's Standard Library may be - used. (The Cambria API server doesn't have access to plugged in - filters.) - -- The filter must be encoded properly in the URL path. + |image2| + + .. |image2| image:: images/image2.png + +- **Filter** + + - A filter examine an event and decides if it matches or doesn't. + - Filters are mainly used in rules to decide if the processing entries + should be executed on the given event. They're also used for settings, + and systems like the Graph Correlator re-use Highland Park's filter + mechanism to specify which alarms fit in a correlation. + - The standard library includes a number of simple filters. The Equals + filter, for example, compares a field's value with some other value + and returns true if the values match. + - The standard library also includes filter classes called And, Or, and + Not, so you can compose more complex filters. For example, written in + the standard JSON config format: + + +-----------------------------------------+ + | "filter":{ | + | "class":"And", | + | "filters": | + | [ | + | { "class":"Equals", "foo":"abc" }, | + | { "class":"Assigned", "field":"bar" } | + | ] | + | } | + +-----------------------------------------+ + + - This filter matches events in which the field "foo" has value "abc" + and the field "bar" is assigned to some value (as opposed to not being + present on the event). + - Filters are used by the consumers to filter out data and consume only + specific set of data which matches the conditions mentioned in filter. + - Filters can be passed as a query parameter by the consumer in consume + request as mentioned below: + - **http://localhost:8080/DMaaP/dmaaprest/events/DMaaP/consumergroup/mHOeNFY4XiWx4CBa?filter=\\{"class":"Equals", + "field":"email", "value":"`test@abc.com `__" }** + - Filters can be applied only on data in JSON format i.e. if applied, + filters will automatically ignore any non-json data. + - While consuming, request CONTENT\_TYPE is not relevant to filter. + + The MR API allows a subscriber pass a Highland Park filter as part of + the GET request. This will filter the stream of messages sent back to + the subscriber, but for this to work, there are some requirements: + + - The message payload must be JSON + + - Only a filter built from Highland Park's Standard Library may be + used. (The Cambria API server doesn't have access to plugged in + filters.) + + - The filter must be encoded properly in the URL path. Server-side filtering can also be setup in the Java client as illustrated below @@ -577,6 +589,6 @@ messages returned from the GET call. The following link provide details of building some of the filter to illustrate Filter Builder. It is not meant to cover and provide examples of every filter -.. |image1| image:: images/image1.png -.. |image2| image:: images/image2.png + + diff --git a/docs/Installation/Installation.rst b/docs/Installation/Installation.rst index 8026928..3723a19 100644 --- a/docs/Installation/Installation.rst +++ b/docs/Installation/Installation.rst @@ -29,14 +29,12 @@ kafka runs on 172.18.0.2 and dmaap on 172.18.0.4. This should start 3 containers. -6) Run ‘docker ps’. It should show 3 containers. +6) Run docker ps. It should show 3 containers. |image0| .. |image0| image:: docker.png - :width: 5.84375in - :height: 0.76042in - + Testing ------- diff --git a/docs/message-router/image1.png b/docs/message-router/image1.png new file mode 100644 index 0000000..100973d Binary files /dev/null and b/docs/message-router/image1.png differ diff --git a/docs/message-router/message router.jpg b/docs/message-router/message router.jpg deleted file mode 100644 index 100973d..0000000 Binary files a/docs/message-router/message router.jpg and /dev/null differ diff --git a/docs/message-router/message-router.rst b/docs/message-router/message-router.rst index 983603a..d8c597b 100644 --- a/docs/message-router/message-router.rst +++ b/docs/message-router/message-router.rst @@ -6,13 +6,10 @@ Architecture In DMaaP Message Router, Restful web service is exposed to client to perform any needed action with Kafka. After getting the request it calls the Message router service layer which is created using AJSC ( AT&T Java Service Container) . AJSC finally calls Kafka services and response is sent back. -|image0| - -.. |image0| image:: message router.jpg - :height: 600px - :width: 800px - + |image0| + .. |image0| image:: image1.png + HTTP Service APIs ------------------ -- cgit 1.2.3-korg