I have just read through the recommended link and examples from typesafe 
config github page. HOCON seems pretty powerful I will try that out. 
All the defaults can be got through fallback mechanism and I for hostname 
and port config I would still have to use either Java Properties or 
parseString right?

Just for understanding can you point out what is the issue with 
 properties.put("akka.actor.serialization-bindings.\"java.lang.String\"", 
"myown");
 

On Friday, January 10, 2014 3:37:36 PM UTC-8, √ wrote:
>
> In other words: Do not put configuration in code, put it outside so it can 
> be modified without having to rebuild.
>
>
> On Sat, Jan 11, 2014 at 12:37 AM, √iktor Ҡlang 
> <[email protected]<javascript:>
> > wrote:
>
>> But your default configuration in a .conf file using HOCON and use the 
>> fallback mechanism to get your defaults.
>>
>> Please read this blog post for inspiration: 
>> http://marcinkubala.wordpress.com/2013/10/09/typesace-config-hocon/
>>
>> Cheers,
>> √
>>
>>
>> On Sat, Jan 11, 2014 at 12:30 AM, vijay krishna 
>> <[email protected]<javascript:>
>> > wrote:
>>
>>> I basically wanted to have some default base configuration like : 
>>>    
>>>  public DefaultConfig(){
>>>         properties = new Properties();
>>>         properties.put("akka.actor.provider", 
>>> "akka.remote.RemoteActorRefProvider");
>>>         properties.put("akka.remote.transport", "akka.remote.netty.tcp");
>>>         
>>>         // Serialization
>>>         properties.put("akka.actor.serialize-messages", "on");
>>>         properties.put("akka.actor.serializers.myown", 
>>> "AkkaMpi.CustomSerializer");
>>>         
>>> properties.put("akka.actor.serialization-bindings.\"java.lang.String\"", 
>>> "myown");
>>>         
>>> properties.put("akka.actor.serialization-bindings.\"com.x.events.myevent\"",
>>>  
>>> "myown");
>>>
>>>         //Dispatcher
>>>         properties.put("my-fork-join-dispatcher.type", "Dispatcher");
>>>         properties.put("my-fork-join-dispatcher.executor", 
>>> "fork-join-executor");
>>>         properties.put("my-fork-join-dispatcher.throughput", "1");
>>>         properties.put("my-fork-join-dispatcher.mailbox-capacity", 
>>> "10000");
>>>         properties.put("my-fork-join-dispatcher.mailbox-type", 
>>> "akka.dispatch.BoundedMailbox");
>>>
>>>     }
>>>
>>>    followed by having a custom configuration for host name and port 
>>> which I get in my application only at runtime at which point I would like 
>>> to 
>>>    get default config properties and add these 2 properties like this :
>>>     ("akka.remote.netty.tcp.hostname", hostname);
>>>     ("akka.remote.netty.tcp.port", port);
>>>
>>>     and now create the Config object to create the actor system. 
>>>    In the programmatic API I think I  have to hardwire the above 2 
>>> params which is not appropriate for me and
>>>    parseString I think is slightly cumbersome compared to just doing 
>>> properties.put()    
>>>  
>>>
>>>    
>>>
>>> On Friday, January 10, 2014 3:08:38 PM UTC-8, √ wrote:
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, Jan 11, 2014 at 12:01 AM, vijay krishna <[email protected]
>>>> > wrote:
>>>>
>>>>> Oh wow that works thank you so much Victor and Patrick, just another 
>>>>> question : 
>>>>> I was trying to use Java Properties class and try, properties like :
>>>>>         properties.put("akka.actor.provider", 
>>>>> "akka.remote.RemoteActorRefProvider"); 
>>>>> get through with out problems
>>>>>         but, 
>>>>>         
>>>>> properties.put("akka.actor.serialization-bindings.\"java.lang.String\"", 
>>>>> "myown"); throws an exception
>>>>>         
>>>>>         Exception in thread "main" java.lang.ClassNotFoundException: 
>>>>> "java
>>>>>
>>>>> Is it another representation mistake that I made?
>>>>>
>>>>  
>>>> May I ask why are you manually using Properties instead of either A) 
>>>> using the parseString or B) Using the programmatic Config API ?
>>>>
>>>> Cheers,
>>>> √
>>>>  
>>>>
>>>>>
>>>>>
>>>>> On Friday, January 10, 2014 2:25:50 PM UTC-8, Patrik Nordwall wrote:
>>>>>
>>>>>> Try to add line breaks "\n" in ss
>>>>>>
>>>>>> /Patrik
>>>>>>
>>>>>> 10 jan 2014 kl. 23:08 skrev vijay krishna <[email protected]>:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> From the documentation at http://doc.akka.io/docs/akka/snapshot/java/
>>>>>> serialization.html, writing up serialization configuration through 
>>>>>> Java code can be done using :
>>>>>>
>>>>>>
>>>>>>    1. val config = ConfigFactory.parseString(""" 
>>>>>>    2. akka {
>>>>>>    3. actor { 
>>>>>>    4. serializers {
>>>>>>    5. java = "akka.serialization.JavaSerializer" 
>>>>>>    6. proto = "akka.remote.serialization.ProtobufSerializer" 
>>>>>>    7. myown = "docs.serialization.MyOwnSerializer" 
>>>>>>    8. }
>>>>>>    9.   
>>>>>>    10. serialization-bindings {
>>>>>>    11.  "java.lang.String" = java 
>>>>>>    12. "docs.serialization.Customer" = java 
>>>>>>    13. "com.google.protobuf.Message" = proto 
>>>>>>    14. "docs.serialization.MyOwnSerializable" = myown 
>>>>>>    15. "java.lang.Boolean" = myown 
>>>>>>    16. }
>>>>>>    17. } 
>>>>>>    18. }
>>>>>>    19. """) 
>>>>>>
>>>>>>     
>>>>>>      I tried that and I don't seem to have any success. 
>>>>>>
>>>>>>      I tried doing this
>>>>>>      String ss =
>>>>>>                 "akka {" +
>>>>>>                  "   actor {" +
>>>>>>                 "       serializers {" +
>>>>>>                 "               myown = \"AkkaMpi.CustomSerializer\""+
>>>>>>                 "       }"+
>>>>>>
>>>>>>                 "serialization-bindings { "+
>>>>>>                 "           \"java.lang.String\" = myown" +
>>>>>>                 "           \"com.mypackage.myevent\" = myown"+
>>>>>>                 "           \"com.mypackage.mymessage\" = myown"+
>>>>>>                 "           }" +
>>>>>>                 "       }"+
>>>>>>                 "   }"
>>>>>>                 ;
>>>>>>   Followed by :
>>>>>>                Config config = ConfigFactory.parseString(ss);
>>>>>>
>>>>>>      I get the following error : 
>>>>>>                Exception in thread "main" com.typesafe.config.
>>>>>> ConfigException$Parse: String: 1: Expecting close brace } or a 
>>>>>> comma, got 'serialization-bindings' (if you intended 
>>>>>> 'serialization-bindings' to be part of the value for 'serializers', try 
>>>>>> enclosing the value in double quotes)
>>>>>>   
>>>>>>
>>>>>>     Any help will be appreciated!
>>>>>>
>>>>>>
>>>>>>  -- 
>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>>>>> p/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.
>>>>>>
>>>>>>  -- 
>>>>> >>>>>>>>>> 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.
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> Cheers,
>>>> √
>>>>
>>>> * Viktor Klang*
>>>> *Director of Engineering*
>>>> Typesafe <http://www.typesafe.com/>
>>>>
>>>> Twitter: @viktorklang
>>>>  
>>>  -- 
>>> >>>>>>>>>> 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] <javascript:>.
>>> To post to this group, send email to [email protected]<javascript:>
>>> .
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> -- 
>> Cheers,
>> √
>>
>> * Viktor Klang*
>> *Director of Engineering*
>> Typesafe <http://www.typesafe.com/>
>>
>> Twitter: @viktorklang
>>  
>
>
>
> -- 
> Cheers,
> √
>
> * Viktor Klang*
> *Director of Engineering*
> Typesafe <http://www.typesafe.com/>
>
> Twitter: @viktorklang
>  

-- 
>>>>>>>>>>      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