Reputation: 39
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.
Upvotes: 0
Views: 153
Reputation: 9006
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;
}
}
Upvotes: 2