MikeM
MikeM

Reputation: 61

AKKA.Net Clustering and Shared Resource

Hey I'm doing some reading and watching some videos on AKKA.Net and am loving what I am seeing. I want to try AKKA.net in an existing application I have but I need help clarifying some things

Scenario
I want to create an Akka.net cluster with:

Questions

  1. How do I ensure that the tickets have unique counter values? I am used to the locks implimentation but what would be the actor implimentation?
  2. if a node is disconnected from the cluster is an event raised that I can catch to make the necessary adjustments?

Upvotes: 2

Views: 309

Answers (1)

easuter
easuter

Reputation: 1197

  1. How do I ensure that the tickets have unique counter values?

If you can't access the actor system to request a "counter" or identifier, then use something like a GUID to uniquely identify a resource (Guid.NewGuid()). If you require a global integer counter then you'll have to implement an actor which tracks this counter and dispenses new values on demand.

  1. if a node is disconnected from the cluster is an event raised that I can catch to make the necessary adjustments?

Yes, you can listen to Cluster gossip events and determine when a node has been disconnected and decide if it is no longer available:

http://getakka.net/docs/clustering/cluster-extension#working-with-cluster-gossip

Upvotes: 1

Related Questions