-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Horusiath/release-2.1
Pre-release 2.1
- Loading branch information
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
//----------------------------------------------------------------------- | ||
// <copyright file="Actors.fs" company="Akka.NET Project"> | ||
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> | ||
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net> | ||
// Copyright (C) 2015 Bartosz Sypytkowski <gttps://github.com/Horusiath> | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
module Akkling.Behaviors | ||
|
||
/// <summary> | ||
/// An empty actor behavior, which ignores all incoming messages. | ||
/// </summary> | ||
let ignore (context:Actor<'Message>) : Behavior<'Message> = | ||
let rec loop () = actor { | ||
let! _ = context.Receive() | ||
return! loop () | ||
} | ||
loop () | ||
|
||
/// <summary> | ||
/// Actor behavior, which resends message back to it's sender. | ||
/// </summary> | ||
let echo (context: Actor<'Message>) : Behavior<'Message> = | ||
let rec loop () = actor { | ||
let! msg = context.Receive() | ||
context.Sender () <! msg | ||
return! loop () | ||
} | ||
loop () |