Method: Search Event Sequences - C Sharp
public async static Task<SearchEventWithPatternResponse> SearchEventWithPattern(SearchEventWithPatternRequest search) {}
Parameter | Type | Description |
---|---|---|
search | SearchEventWithPattern | Event sequence search parameters |
A method of the Event Agent.
Search event sequences that match a pattern, that all events are emitted with the right order and each matches given conditions.
Returns SearchEventWithPatternResponse
, which contains matched event sequences.
Parameter Type
SearchEventWithPattern
Event sequence search parameters.
Properties:
Property | Type | Description |
---|---|---|
Sequences | List<Sequence> | A set of event query conditions; default: empty collection |
MaxSpan | string | Search timestamp span (syntax reference); default: "30s" |
Filter | Filter? | Filter conditions (see Search Events) |
warning
Sequences
must contain at least 2 set of conditions in order to search event sequences. An error will be thrown if only one set is provided.
Constructors:
public SearchEventWithPatternRequest()
public SearchEventWithPatternRequest(
List<Sequence> sequences, // Sequences
string maxSpan, // MaxSpan
Filter filter // Filter
)
Sub Parameter Type
Sequence
Properties:
Property | Type | Description |
---|---|---|
Conditions | List<Condition> | Query condition for each event; default: empty collection |
SharedFields | List<string> | Event shared field values; default: empty collection |
Type | string | Event type or group; default: "any" |
Constructors:
public Sequence()
public Sequence(
List<Condition> conditions, // Conditions
List<string> sharedFields, // SharedFields
string type // Type
)
Condition
Properties:
Property | Type | Description |
---|---|---|
Field | string | Event field name |
Value | string | Value to be matched |
Op | Op | Operator |
Constructor:
public Condition(
string field, // Field
string value, // Value
Op op // Op
)
Op
Operators for event query condition in the sequence:
public enum Op
{
Eq = 1, // Equal to
Ne = 2, // Not equal to
Gt = 3, // Greater than
Lt = 4, // Less than
Gte = 5, // Greater than or equal to
Lte = 6, // Less than or equal to
}
Return Type
SearchEventWithPatternResponse
Search result of matched event sequences.
Member | Type | Description |
---|---|---|
Sequences | List<SequenceResult> | Queried sequences |
Sun Return Type
SequencesResult
Events in a queried sequence.
Member | Type | Description |
---|---|---|
Events | List<Event> | Queried events in a sequence |
JoinKeys | List<string> |
Examples
var query = await EventAgent.SearchEventWithPattern(
new SearchEventWithPattern(
new Sequence(
new Condition(
"label_name",
"some label name",
Op.Eq
)
),
new Sequence(
new Condition(
"source_digital_identity",
"some source DID",
Op.Eq
),
new Condition(
"target_digital_identity",
"some target DID",
Op.Ne
)
),
// more conditions...
"30s" // max span
)
);
var sequences = query.Sequences;
foreach (var sequence in sequences)
{
var events = sequence.Events;
foreach (var event in events)
{
string label_name = event.LabelName;
string meta = event.Meta;
string logicPid = event.LogicIdentityContext.PermanentIdentity.ToString();
}
}