Show / Hide Table of Contents

# Interface IEvents

Provides functionality for event notifications on nodes defined by ClusterGroup.

All members are thread-safe and may be used concurrently from multiple threads.

###### Namespace: Apache.Ignite.Core.Events

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public interface IEvents

### Properties

#### ClusterGroup

Gets the cluster group to which this instance belongs.

##### Declaration

    IClusterGroup ClusterGroup { get; }

##### Property Value

Type | Description
--- | ---
IClusterGroup |

### Methods

#### DisableLocal(IEnumerable<Int32>)

Disables provided events. Allows to stop recording events that were enabled before. Note that specified events will be disabled regardless of whether local node is in this cluster group or not.

##### Declaration

    void DisableLocal(IEnumerable<int> types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.IEnumerable<System.Int32> | types | Events to disable.

#### DisableLocal(Int32[])

Disables provided events. Allows to stop recording events that were enabled before. Note that specified events will be disabled regardless of whether local node is in this cluster group or not.

##### Declaration

    void DisableLocal(params int[] types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32[] | types | Events to disable.

#### EnableLocal(IEnumerable<Int32>)

Enables provided events. Allows to start recording events that were disabled before. Note that provided events will be enabled regardless of whether local node is in this cluster group or not.

##### Declaration

    void EnableLocal(IEnumerable<int> types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.IEnumerable<System.Int32> | types | Events to enable.

#### EnableLocal(Int32[])

Enables provided events. Allows to start recording events that were disabled before. Note that provided events will be enabled regardless of whether local node is in this cluster group or not.

##### Declaration

    void EnableLocal(params int[] types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32[] | types | Events to enable.

#### GetEnabledEvents()

Gets types of enabled events.

##### Declaration

    ICollection<int> GetEnabledEvents()

##### Returns

Type | Description
--- | ---
System.Collections.Generic.ICollection<System.Int32> | Types of enabled events.

#### IsEnabled(Int32)

Determines whether the specified event is enabled.

##### Declaration

    bool IsEnabled(int type)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | type | Event type.

##### Returns

Type | Description
--- | ---
System.Boolean | Value indicating whether the specified event is enabled.

#### LocalListen<T>(IEventListener<T>, IEnumerable<Int32>)

Adds an event listener for local events. Note that listener will be added regardless of whether local node is in this cluster group or not.

##### Declaration

    void LocalListen<T>(IEventListener<T> listener, IEnumerable<int> types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventListener<T> | listener | Predicate that is called on each received event. If predicate returns false, it will be unregistered and will stop receiving events.
System.Collections.Generic.IEnumerable<System.Int32> | types | Event types for which this listener will be notified, should not be empty.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### LocalListen<T>(IEventListener<T>, Int32[])

Adds an event listener for local events. Note that listener will be added regardless of whether local node is in this cluster group or not.

##### Declaration

    void LocalListen<T>(IEventListener<T> listener, params int[] types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventListener<T> | listener | Predicate that is called on each received event. If predicate returns false, it will be unregistered and will stop receiving events.
System.Int32[] | types | Event types for which this listener will be notified, should not be empty.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### LocalQuery(IEnumerable<Int32>)

Queries local node for events using of specified types.

##### Declaration

    ICollection<IEvent> LocalQuery(IEnumerable<int> types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.IEnumerable<System.Int32> | types | Event types to be queried. Optional.

##### Returns

Type | Description
--- | ---
System.Collections.Generic.ICollection<IEvent> | Collection of Ignite events found on local node.

#### LocalQuery(Int32[])

Queries local node for events using of specified types.

##### Declaration

    ICollection<IEvent> LocalQuery(params int[] types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32[] | types | Event types to be queried. Optional.

##### Returns

Type | Description
--- | ---
System.Collections.Generic.ICollection<IEvent> | Collection of Ignite events found on local node.

#### RecordLocal(IEvent)

Records customer user generated event. All registered local listeners will be notified.

NOTE: all types in range from 1 to 1000 are reserved for internal Ignite events and should not be used by user-defined events. Attempt to record internal event with this method will cause System.ArgumentException to be thrown.

##### Declaration

    void RecordLocal(IEvent evt)

##### Parameters

Type | Name | Description
--- | --- | ---
IEvent | evt | Locally generated event.

##### Exceptions

Type | Condition
--- | ---
System.ArgumentException | If event type is within Ignite reserved range (1 to 1000)

#### RemoteQuery<T>(IEventFilter<T>, Nullable<TimeSpan>, IEnumerable<Int32>)

Queries nodes in this cluster group for events using passed in predicate filter for event selection.

##### Declaration

    ICollection<T> RemoteQuery<T>(IEventFilter<T> filter, TimeSpan? timeout = default (TimeSpan? ), IEnumerable<int> types = null)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventFilter<T> | filter | Predicate filter used to query events on remote nodes.
System.Nullable<System.TimeSpan> | timeout | Maximum time to wait for result, null or 0 to wait forever.
System.Collections.Generic.IEnumerable<System.Int32> | types | Event types to be queried.

##### Returns

Type | Description
--- | ---
System.Collections.Generic.ICollection<T> | Collection of Ignite events returned from specified nodes.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### RemoteQuery<T>(IEventFilter<T>, Nullable<TimeSpan>, Int32[])

Queries nodes in this cluster group for events using passed in predicate filter for event selection.

##### Declaration

    ICollection<T> RemoteQuery<T>(IEventFilter<T> filter, TimeSpan? timeout = default (TimeSpan? ), params int[] types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventFilter<T> | filter | Predicate filter used to query events on remote nodes.
System.Nullable<System.TimeSpan> | timeout | Maximum time to wait for result, null or 0 to wait forever.
System.Int32[] | types | Event types to be queried.

##### Returns

Type | Description
--- | ---
System.Collections.Generic.ICollection<T> | Collection of Ignite events returned from specified nodes.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### RemoteQueryAsync<T>(IEventFilter<T>, Nullable<TimeSpan>, IEnumerable<Int32>)

Queries nodes in this cluster group for events using passed in predicate filter for event selection.

##### Declaration

    Task<ICollection<T>> RemoteQueryAsync<T>(IEventFilter<T> filter, TimeSpan? timeout = default (TimeSpan? ), IEnumerable<int> types = null)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventFilter<T> | filter | Predicate filter used to query events on remote nodes.
System.Nullable<System.TimeSpan> | timeout | Maximum time to wait for result, null or 0 to wait forever.
System.Collections.Generic.IEnumerable<System.Int32> | types | Event types to be queried.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.ICollection<T>> | Collection of Ignite events returned from specified nodes.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### RemoteQueryAsync<T>(IEventFilter<T>, Nullable<TimeSpan>, Int32[])

Queries nodes in this cluster group for events using passed in predicate filter for event selection.

##### Declaration

    Task<ICollection<T>> RemoteQueryAsync<T>(IEventFilter<T> filter, TimeSpan? timeout = default (TimeSpan? ), params int[] types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventFilter<T> | filter | Predicate filter used to query events on remote nodes.
System.Nullable<System.TimeSpan> | timeout | Maximum time to wait for result, null or 0 to wait forever.
System.Int32[] | types | Event types to be queried.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.ICollection<T>> | Collection of Ignite events returned from specified nodes.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### StopLocalListen<T>(IEventListener<T>, IEnumerable<Int32>)

Removes local event listener.

##### Declaration

    bool StopLocalListen<T>(IEventListener<T> listener, IEnumerable<int> types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventListener<T> | listener | Local event listener to remove.
System.Collections.Generic.IEnumerable<System.Int32> | types | Types of events for which to remove listener. If not specified, then listener will be removed for all types it was registered for.

##### Returns

Type | Description
--- | ---
System.Boolean | True if listener was removed, false otherwise.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### StopLocalListen<T>(IEventListener<T>, Int32[])

Removes local event listener.

##### Declaration

    bool StopLocalListen<T>(IEventListener<T> listener, params int[] types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventListener<T> | listener | Local event listener to remove.
System.Int32[] | types | Types of events for which to remove listener. If not specified, then listener will be removed for all types it was registered for.

##### Returns

Type | Description
--- | ---
System.Boolean | True if listener was removed, false otherwise.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### WaitForLocal(IEnumerable<Int32>)

Waits for the specified events.

##### Declaration

    IEvent WaitForLocal(IEnumerable<int> types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.IEnumerable<System.Int32> | types | Types of the events to wait for. If not provided, all events will be passed to the filter.

##### Returns

Type | Description
--- | ---
IEvent | Ignite event.

#### WaitForLocal(Int32[])

Waits for the specified events.

##### Declaration

    IEvent WaitForLocal(params int[] types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32[] | types | Types of the events to wait for. If not provided, all events will be passed to the filter.

##### Returns

Type | Description
--- | ---
IEvent | Ignite event.

#### WaitForLocal<T>(IEventFilter<T>, IEnumerable<Int32>)

Waits for the specified events.

##### Declaration

    T WaitForLocal<T>(IEventFilter<T> filter, IEnumerable<int> types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventFilter<T> | filter | Optional filtering predicate. Event wait will end as soon as it returns false.
System.Collections.Generic.IEnumerable<System.Int32> | types | Types of the events to wait for. If not provided, all events will be passed to the filter.

##### Returns

Type | Description
--- | ---
T | Ignite event.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### WaitForLocal<T>(IEventFilter<T>, Int32[])

Waits for the specified events.

##### Declaration

    T WaitForLocal<T>(IEventFilter<T> filter, params int[] types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventFilter<T> | filter | Optional filtering predicate. Event wait will end as soon as it returns false.
System.Int32[] | types | Types of the events to wait for. If not provided, all events will be passed to the filter.

##### Returns

Type | Description
--- | ---
T | Ignite event.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### WaitForLocalAsync(IEnumerable<Int32>)

Waits for the specified events.

##### Declaration

    Task<IEvent> WaitForLocalAsync(IEnumerable<int> types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.IEnumerable<System.Int32> | types | Types of the events to wait for. If not provided, all events will be passed to the filter.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IEvent> | Ignite event.

#### WaitForLocalAsync(Int32[])

Waits for the specified events.

##### Declaration

    Task<IEvent> WaitForLocalAsync(params int[] types)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32[] | types | Types of the events to wait for. If not provided, all events will be passed to the filter.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IEvent> | Ignite event.

#### WaitForLocalAsync<T>(IEventFilter<T>, IEnumerable<Int32>)

Waits for the specified events.

##### Declaration

    Task<T> WaitForLocalAsync<T>(IEventFilter<T> filter, IEnumerable<int> types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventFilter<T> | filter | Optional filtering predicate. Event wait will end as soon as it returns false.
System.Collections.Generic.IEnumerable<System.Int32> | types | Types of the events to wait for. If not provided, all events will be passed to the filter.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<T> | Ignite event.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.

#### WaitForLocalAsync<T>(IEventFilter<T>, Int32[])

Waits for the specified events.

##### Declaration

    Task<T> WaitForLocalAsync<T>(IEventFilter<T> filter, params int[] types)where T : IEvent

##### Parameters

Type | Name | Description
--- | --- | ---
IEventFilter<T> | filter | Optional filtering predicate. Event wait will end as soon as it returns false.
System.Int32[] | types | Types of the events to wait for. If not provided, all events will be passed to the filter.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<T> | Ignite event.

##### Type Parameters

Name | Description
--- | ---
T | Type of events.