7 people like it.

Getting started with Akka.NET

Getting started with Akka.NET

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
// Create Console-application, then NuGet: Install-Package Akka
module AkkaConsoleApplication
open Akka
open Akka.Actor
 
type Greet(who) =
    member x.Who = who
 
type GreetingActor() as g =
    inherit ReceiveActor()
    do g.Receive<Greet>(fun (greet:Greet) -> printfn "Hello %s" greet.Who)
 
[<EntryPoint>]  // Works also from F#-Interactive.
let main argv = // More details: http://getakka.net/wiki/Getting%20started
    let system = ActorSystem.Create "MySystem"
    let greeter = system.ActorOf<GreetingActor> "greeter"
    "World" |> Greet |> greeter.Tell
    System.Console.ReadLine() |> ignore
    0 // return an integer exit code
module AkkaConsoleApplication
namespace Akka
namespace Akka.Actor
Multiple items
type Greet =
  new : who:string -> Greet
  member Who : string

Full name: AkkaConsoleApplication.Greet

--------------------
new : who:string -> Greet
val who : string
val x : Greet
member Greet.Who : string

Full name: AkkaConsoleApplication.Greet.Who
Multiple items
type GreetingActor =
  inherit ReceiveActor
  new : unit -> GreetingActor

Full name: AkkaConsoleApplication.GreetingActor

--------------------
new : unit -> GreetingActor
val g : GreetingActor
Multiple items
type ReceiveActor =
  inherit UntypedActor

Full name: Akka.Actor.ReceiveActor

--------------------
ReceiveActor() : unit
type Receive =
  delegate of obj -> bool

Full name: Akka.Actor.Receive
val greet : Greet
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
property Greet.Who: string
Multiple items
type EntryPointAttribute =
  inherit Attribute
  new : unit -> EntryPointAttribute

Full name: Microsoft.FSharp.Core.EntryPointAttribute

--------------------
new : unit -> EntryPointAttribute
val main : argv:string [] -> int

Full name: AkkaConsoleApplication.main
val argv : string []
val system : ActorSystem
type ActorSystem =
  member ActorOf : props:Props * ?name:string -> IActorRef
  member ActorSelection : actorPath:ActorPath -> ActorSelection + 1 overload
  member AwaitTermination : unit -> unit + 2 overloads
  member DeadLetters : IActorRef
  member Dispatchers : Dispatchers
  member Dispose : unit -> unit
  member EventStream : EventStream
  member GetExtension<'T> : unit -> 'T + 1 overload
  member HasExtension<'T> : unit -> bool + 1 overload
  member Log : ILoggingAdapter
  ...

Full name: Akka.Actor.ActorSystem
ActorSystem.Create(name: string) : ActorSystem
ActorSystem.Create(name: string, config: Configuration.Config) : ActorSystem
val greeter : IActorRef
(extension) IActorRefFactory.ActorOf<'TActor (requires default constructor and 'TActor :> ActorBase)>(?name: string) : IActorRef
ActorSystem.ActorOf(props: Props, ?name: string) : IActorRef
(extension) IActorRef.Tell(message: obj) : unit
ICanTell.Tell(message: obj, sender: IActorRef) : unit
namespace System
type Console =
  static member BackgroundColor : ConsoleColor with get, set
  static member Beep : unit -> unit + 1 overload
  static member BufferHeight : int with get, set
  static member BufferWidth : int with get, set
  static member CapsLock : bool
  static member Clear : unit -> unit
  static member CursorLeft : int with get, set
  static member CursorSize : int with get, set
  static member CursorTop : int with get, set
  static member CursorVisible : bool with get, set
  ...

Full name: System.Console
System.Console.ReadLine() : string
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
Next Version Raw view Test code New version

More information

Link:http://fssnip.net/pV
Posted:9 years ago
Author:Tuomas Hietanen
Tags: akka , actors