Hi Roland

>From 'pure messaging' paradigm this is not all that futuristic, just and
ErrorMessage. Although I do understand that you may want to encapsulate it
inside of a higher level object (e.g., Message's payload with headers
containing additional information), but that may be a whole different
discussion.

Cheers
Oleg



On Tue, Feb 11, 2014 at 5:59 AM, Akka Team <akka.offic...@gmail.com> wrote:

> Hi Oleg,
>
> your proposal is a bit futuristic in the sense that passing in failures as
> normal messages is something that I am only experimenting with for Akka 3
> at the moment ;-)
>
> Regards,
>
> Roland
>
>
>
> On Mon, Feb 10, 2014 at 10:27 PM, Oleg Zhurakousky <
> oleg.zhurakou...@gmail.com> wrote:
>
>> What if you consider Hot Swap Actor, then you could rely on
>> become(behavior).
>> Pseudo-coding:
>> class CacheHotSwapActor extends Actor {
>> def memCacheReceiveLoop:Receive = {
>>  // your code
>> }
>> def redisReceiveLoop:Receive = {
>>  // your code
>> }
>> def receive = {
>>                case java.net.ConnectException =>
>> become(memCacheReceiveLoop)
>>                case ActorInitializationException =>
>> become(memCacheReceiveLoop)
>>                case _ => become(redisReceiveLoop)
>>         }
>> }
>>
>> At least this way you'd avoid vars and whatever problems it may lead to.
>>
>> Cheers
>> Oleg
>>
>>
>> On Mon, Feb 10, 2014 at 12:51 PM, Diego Balduini <
>> nosferatored...@gmail.com> wrote:
>>
>>> Hello
>>>
>>> I want to swap between two cache implementations.
>>> When the first fails, it swap to the second.
>>> This is what i've came to. It works, but i wanna know if you guys have a
>>> better way of doing this, because it seems that this solution is not a good
>>> practice.
>>>
>>> // Actor
>>>
>>>   val redisActor = context.actorOf(Props[RedisActor], "redis")
>>>   val memcachedActor = context.actorOf(Props[MemcachedActor],
>>> "memcached")
>>>
>>>   var cache: ActorRef = memcachedActor
>>>   var state = 0
>>>
>>>   override def supervisorStrategy = {
>>>     def swap() = state match {
>>>       case 0 =>
>>>         state = 1
>>>         cache = redisActor
>>>         Stop
>>>       case _ => Escalate
>>>     }
>>>
>>>     OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
>>>       case e: java.net.ConnectException => swap
>>>       case e: ActorInitializationException => swap
>>>     }
>>>   }
>>>
>>>
>>>
>>>
>>>  --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>> >>>>>>>>>> Search the archives:
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to akka-user+unsubscr...@googlegroups.com.
>>> To post to this group, send email to akka-user@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to akka-user+unsubscr...@googlegroups.com.
>> To post to this group, send email to akka-user@googlegroups.com.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Akka Team
> Typesafe - The software stack for applications that scale
> Blog: letitcrash.com
> Twitter: @akkateam
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://akka.io/faq/
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to