Try this instead, perhaps?
case Event(Success(streamConfig: StreamConfig), req) => {
stay() using StreamConfigRetrieved(streamConfig, req.session)
forMax(timeout)
}
case Event(Success(dockConfig: DockConfig), req) => {
stay() using DockConfigRetrieved(dockConfig, req.session)
forMax(timeout)
}
:: atomly ::
[ [email protected] : www.atomly.com : http://blog.atomly.com/ ...
[ atomiq records : new york city : +1.347.692.8661 ...
[ e-mail [email protected] for atomly info and updates ...
On Tue, Sep 30, 2014 at 1:20 PM, bearrito <[email protected]>
wrote:
>
> I believe I have a misunderstanding of the way the Events are matched.
>
> The below code snippet generates the following exception
>
> case Event(streamConfig : Success[StreamConfig],req: Request) => {
> stay() using StreamConfigRetrieved(streamConfig.get,req.session)
> forMax(timeout)
> }
> case Event(dockConfig : Success[DockConfig], req: Request) => {
> stay() using DockConfigRetrieved(dockConfig.get,req.session)
> forMax(timeout)
> }
>
>
> [akka://CityActorSpec/user/$$a]
> trafficland.commons.data.flycast.DockConfig cannot be cast to
> trafficland.commons.data.flycast.StreamConfig
> java.lang.ClassCastException: trafficland.commons.data.flycast.DockConfig
> cannot be cast to trafficland.commons.data.flycast.StreamConfig
>
> I've watched it take place in the debugger. The first event is matched but
> the Success(StreamConfig) is actually a Success(DockConfig)
>
> Can we not match on generic traits?
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> 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/d/optout.
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> 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/d/optout.