scala - How to pass behavior to Akka actor -
i'm building akka app retrieve rss feeds (xml) several sites. each site create class transform xml generalized object (scala case class) common fields rss feeds:
case class rssfeed(title: string, ...) trait rsstransformer { def getrssfeed(): seq[rssfeed] } class footransformer(...) extends rsstransformer { override def getrssfeed(): : seq[rssfeed] = {...} } class bartransformer(...) extends rsstransformer { override def getrssfeed(): : seq[rssfeed] = {...} }
and want create akka actors , pass each of them implementation of transformer (for example 1 actor work bartransformer
, footransformer
etc).
the problem i'm using di framework (spring) initiate actors, so can't pass transformers through actor`s constructor parameters. way pass using message, passing behavior in messages anti-pattern in akka.
can please advice me how can solve problem, or better if can give me adviŅe on how improve app architecture avoid problem?
thanks
i'm not sure mean "so can't pass transformers through actor's constructor parameters." spring can use constructor-arg
element provide constructor arguments.
if problem must create actors using actorsystem#actorof
method, 1 solution define own factory bean takes actorsystem
, props
constructor arguments , constructs actor.
Comments
Post a Comment