예제 #1
0
    static void Main(string[] args)
    {
        using (var cluster = GetCluster())
            using (var bucket = cluster.OpenBucket("protoactor_test"))
            {
                //NOTE: Don't forget to create index for the bucket!
                //QUERY: CREATE INDEX `persistence` ON `protoactor_test`(type) USING GSI;

                var provider = new CouchbaseProvider(bucket);

                var props = Actor.FromProducer(() => new MyPersistenceActor())
                            .WithReceiveMiddleware(Persistence.Using(provider));

                var pid = Actor.Spawn(props);

                Console.ReadLine();
            }
    }
예제 #2
0
 static void Main(string[] args)
 {
     using (var cluster = GetCluster())
         using (var bucket = cluster.OpenBucket("protoactor-test"))
         {
             var provider = new CouchbaseProvider(bucket, 5);
             var props    = Actor.FromProducer(() => new MyActor())
                            .WithMiddleware(Persistence.Using(provider));
             var pid = Actor.Spawn(props);
             pid.Tell(new RenameCommand {
                 Name = "Christian"
             });
             pid.Tell(new RenameCommand {
                 Name = "Alex"
             });
             pid.Tell(new RenameCommand {
                 Name = "Roger"
             });
             Console.WriteLine("Hello World!");
             Console.ReadLine();
         }
 }