Skip to main content

Method: Search Event Sequences - C Sharp

public async static Task<SearchEventWithPatternResponse> SearchEventWithPattern(SearchEventWithPatternRequest search) {}
ParameterTypeDescription
searchSearchEventWithPatternEvent 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:

PropertyTypeDescription
SequencesList<Sequence>A set of event query conditions; default: empty collection
MaxSpanstringSearch timestamp span (syntax reference); default: "30s"
FilterFilter?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:

PropertyTypeDescription
ConditionsList<Condition>Query condition for each event; default: empty collection
SharedFieldsList<string>Event shared field values; default: empty collection
TypestringEvent type or group; default: "any"

Constructors:

public Sequence()
public Sequence(
List<Condition> conditions, // Conditions
List<string> sharedFields, // SharedFields
string type // Type
)

Condition

Properties:

PropertyTypeDescription
FieldstringEvent field name
ValuestringValue to be matched
OpOpOperator

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.

MemberTypeDescription
SequencesList<SequenceResult>Queried sequences

Sun Return Type

SequencesResult

Events in a queried sequence.

MemberTypeDescription
EventsList<Event>Queried events in a sequence
JoinKeysList<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();
}
}