Hi Brice,

when sending a wrapped message to a destination, then that destination must 
know how to open the envelope, otherwise the message will be lost. I think that 
this principle applies universally, which explains why extra wrapping means 
extra unwrapping in unaware components like the TestActor.

Concerning your meta-data comment: the things you allude to would really be 
incredible, since it would be rather hard to formulate sane semantics for them. 
For example if you send a message with some attached meta-data to someone and 
expect the reply to still contain the meta-data (because the recipient was not 
supposed to know about it in the first place), then how do you suppose that 
meta-data should be picked up by ActorRef.tell()? Given a hypothetical solution 
to this problem, how would you merge conflicting meta-data? How would you 
reason about the size of messages which you send to remote destinations, if 
another actor can just smuggle a few GB of movie streams into it? How do you 
distinguish between sending “unrelated” messages and replies, i.e. where are 
meta-data kept and where not?

The only sane solution is to be explicit about this, which is precisely what 
Akka forces you to do.

Regards,

Roland

12 feb 2014 kl. 16:58 skrev Brice Figureau <[email protected]>:

> Hi all,
> 
> I was playing with Derek Wyatt's implicit message protocol:
> http://derekwyatt.org/2014/01/01/using-scala-implicits-to-implement-a-messaging-protocol.html
> 
> and was able to wrap my messages in a custon envelope.
> 
> Unfortunately it's when using TestKit that things started to get more
> complex.
> Basically, I'd like to be able to write:
> 
> test ! MyMessage // internally this gets enveloped, and does a sender emit 
> MyResponse
> expectMsg(MyResponse)
> 
> But what the implicit sender here (or a TestProbe for what matters) sees
> is the envelope, not the real message.
> 
> Of course I can rewrite the expectMsg to an expectMsgPF with the
> necessary unwrapping, but I'm looking for a more direct way that
> wouldn't force me to rewrite tons of expectMsg all around my code.
> 
> The only other solution I could think of is to have my own TestKit
> implementation that knows how to unwrap the envelope.
> 
> Any ideas beside those two ones?
> 
> (I really wish akka would support custom envelope data or message
> metadata, that would allow to create incredible things without touching
> any line of a given actor code :))
> 
> Thanks!
> -- 
> Brice Figureau
> My Blog: http://www.masterzen.fr/
> 
> -- 
>>>>>>>>>>>     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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/groups/opt_out.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
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