0
votes

I started a Server through the BAT file, and then started a Client to write data through the code, and set the expiration time. Then I want to track expired entries on Client side by subscribing to EVT_CACHE_OBJECT_EXPIRED, but I look at https://issues.apache.org/jira/browse/IGNITE-1682 - RemoteListen has been removed from Ignite.NET, what is the alternative plan? Or are there any examples to look at.

1
Please clarify - what do you intend to do? Then I want to by subscribing to the remote Server is event date - what does this mean?Pavel Tupitsyn
I want to know when cached data expires by subscribing to remote server events, and add my own logic when the data expires.coder-yp
I want to know when the cached data is expired by subscribing to server-side events (EVT_CACHE_OBJECT_EXPIRED), but right now the.NET API has LocalListen, not RemoteListen.coder-yp

1 Answers

2
votes

You can use LocalListen on the server node, and then use Ignite Messaging to notify clients about the event.

Server

server.GetEvents().LocalListen(new EventListener(server.GetMessaging()), EventType.CacheObjectExpired);

...

public class EventListener  : IEventListener<CacheEvent>
{
    private readonly IMessaging _messaging;

    public EventListener(IMessaging messaging)
    {
        _messaging = messaging;
    }

    public bool Invoke(CacheEvent evt)
    {
        _messaging.Send(evt.Key, "Expired");

        return true;
    }
}

Client

client.GetMessaging().LocalListen(new MessageListener(), "Expired");

...

public class MessageListener : IMessageListener<object>
{
    public bool Invoke(Guid nodeId, object message)
    {
        Console.WriteLine("Expired: " + message);

        return true;
    }
}