This will be supported in Akka 2.4. It has already been merged <https://github.com/akka/akka/pull/16794> to the master branch. /Patrik
On Wed, Mar 18, 2015 at 10:26 PM, Michael Ahlers < [email protected]> wrote: > I've expanded upon the Stack Overflow question with greater detail (and > grammatical corrections). This may make a lot more sense now, in light of > documentation describing a feature that's almost what I need. > > Revised question: > > Is it possible to provide storage plugins (for journaling and > snapshotting) instantiated manually to persistent actors? (As opposed to > referencing those that've been hard-coded by configuration.) In other > words, rather than override journal and snapshot plugin ids. as described > by *Multiple persistence plugin configurations* from the manual > <http://doc.akka.io/docs/akka/snapshot/scala/persistence.html>, I'd like > to do this: > > trait ActorWithOverridePlugins extends PersistentActor { > > override def persistenceId = "123" > > /* Not real. */ > override def journalPlugin = new JournalPlugin() > > /* Not real. */ > override def snapshotPlugin = new SnapshotPlugin() > } > > To briefly explain my use case, I'd like to write a parametrizable plugin > that will store case classes transparently. It would be instantiated with > implementations of whatever Reads and Writes (from Play Framework's JSON > library) are appropriate for the case classes any particular persistent > actor might handle. > > Building on the previous example, it might look like this (with explicit > types for clarity): > > case class Event(timestamp:Long, message:String) > val format:Format[Event] = Json.format[Event] > trait EventsActor extends PersistentActor { > > override def persistenceId = "events" > > /* Not real. Also, should be a singleton. */ > override def journalPlugin = new HypotheticalJournalPlugin[Event](format) > > /* Not real. Also, should be a singleton. */ > override def snapshotPlugin = new HypotheticalSnapshotPlugin[Event](format) > } > > Writing a configuration for each and every type I might want to handle is > doable, but verbose and painful. > > -- > >>>>>>>>>> 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. > -- Patrik Nordwall Typesafe <http://typesafe.com/> - Reactive apps on the JVM Twitter: @patriknw -- >>>>>>>>>> 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.
