On Monday, June 2, 2014 8:51:06 AM UTC-7, Evan Chan wrote:
>
> Hey guys,
>
> I would like to run an idea by the fine Akka community - which is to
> discuss what it would take to turn Akka into a platform for building a
> network of "microservices": each one independently redeployable and easy to
> change, yet through a common platform, take advantage of the distributed
> supervision, messaging and other goodies from Akka.
>
>
> *Related - Polyglot support*
> How would a Ruby/Python/etc process talk to an Akka network? My thoughts:
> - Easiest way would be to have a way to automagically generate HTTP
> endpoints that includes case class serialization to/from JSON. Type
> classes to handle special data types.
> - Did you guys define the Akka binary protocol and keep it stable?
> Client libraries could then be written for different langauges, but this
> doesn't solve the problem of message format -- Java serialization and
> Chill/Kryo won't work.
>
>
Thought I'd share how I'm using Jruby with Akka. My opinion is that the
best solution is an idiomatic wrapper around Akka for whatever language you
are using.
I created a ruby class that inherits from UntypedActor, and all of my ruby
actors inherit from that. That let me do a few things that were more
idiomatic ruby.
Say I have a ruby actor class called MyActor. To get an actor ref to it, I
can do this:
actor_ref = MyActor.find
Or all in one go...
MyActor.find.tell(message) or MyActor.find.ask(message,100)
find takes one argument, the default is the class name. So if you created
the actor with a different name you do this:
MyActor.find("my_other_actor") (or just Actor::Base.find("my_other_actor")
I can also do MyActor.find_remote(server,name)
The find method actually returns an instance of my own actor ref class.
This was primarily to provide a simple interface to ask/tell, and not have
to deal with futures or ActorSelection/AskableActorSelection directly.
I also created a simple builder and factory that lets me create actors like
so:
Actor::Builder.new(MyActor,arg1,arg2,arg3).with_name("myname").with_router(Javalib::RoundRobinRouter,10).start
It also supports with_parent and with_dispatcher.
The args are called on the actor's post_init method by the factory.
I use protocol buffers for all messages. I use the protostuf library as I
just like it's api better and it's much more idiomatic to use from ruby.
Chris
--
>>>>>>>>>> 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.