There are some tricks you could do with HOCON to reuse the first 
configuration but change just some specifics.

You should be able to do something like this:

myapp.mailbox-small {
  mailbox-type = "akka.dispatch.BoundedMailbox"
  mailbox-capacity = 1
  mailbox-push-timeout-time = 1s
}

myapp.mailbox-medium = ${myapp.mailbox-small}
myapp.mailbox-medium.mailbox-capacity = 5

For more details, see the Typesafe Config library docs here: 
https://github.com/typesafehub/config#uses-of-substitutions

--
Johan


On Monday, September 19, 2016 at 11:09:37 AM UTC+2, Mehmet Cem Güntürkün 
wrote:
>
> Btw I have one more question, is this the right way to define mailboxes 
> for actors, I mean I create a mailbox type like this:
>
> bounded-mailbox {
>  mailbox-type = "akka.dispatch.BoundedMailbox"
>  mailbox-capacity = 1
>  mailbox-push-timeout-time = 1s
> }
>
>
> and set mailbox type to actors:
>
>   /singletestactorone {
>    mailbox = bounded-mailbox
>   }
>
>   /singletestactortwo {
>    mailbox = bounded-mailbox
>   }
>   
>   /singletestactorthree {
>    mailbox = bounded-mailbox
>   }
>
>
>
> but if I have a couple of actors have same mailbox type but different 
> mailbox sizes, should I create new mailbox types for each size?
>
> 8 Eylül 2016 Perşembe 15:47:39 UTC+3 tarihinde Akka Team yazdı:
>>
>> Hi Mehmet,
>>
>> Easiest would be to select the mailbox with props:
>>
>> system.actorOf(Props[TestActor]
>>   .withMailbox("bounded-mailbox") // here
>>   .withRouter(FromConfig),
>>   "groupedtestactor")
>>
>> But you could also do it purely from config with a deployment section 
>> like this:
>>
>> "/groupedtestactor/*" {
>>   mailbox = bounded-mailbox
>> }
>>
>> Since the pool will create the routees as children this configures all 
>> direct children of the router to use the bounded-mailbox
>>
>> --
>> Johan
>> Akka Team
>>
>>
>> On Fri, Aug 26, 2016 at 2:53 PM, Mehmet Cem Güntürkün <
>> mehmetcem...@gmail.com> wrote:
>>
>>>
>>> Hello everyone,
>>>
>>> When I try to set a bounded mailbox to routees of RoundRobinPool, Akka, 
>>> kind of ignores the configuration parameter.
>>>
>>>
>>> Here is the sample for configuration:
>>>
>>>
>>> bounded-mailbox {
>>>   mailbox-type = "akka.dispatch.BoundedMailbox"
>>>   mailbox-capacity = 1
>>>   mailbox-push-timeout-time = 1s
>>> }
>>>
>>> akka.actor.deployment {
>>>   /singletestactor {
>>>     mailbox = bounded-mailbox
>>>   }
>>>
>>>   /groupedtestactor {
>>>     mailbox = bounded-mailbox
>>>
>>>     router = round-robin-pool
>>>     nr-of-instances = 5
>>>   }
>>> }
>>>
>>>
>>> and Here is the test code:
>>>
>>>
>>> object MailboxTest {
>>>   def main(args: Array[String]): Unit = {
>>>     val actorSystem = ActorSystem()
>>>     val singleTestActor = actorSystem.actorOf(Props[TestActor], 
>>> "singletestactor")
>>>     for (i <- 1 to 10) {
>>>       singleTestActor ! Hello(i)
>>>     }
>>>
>>>
>>>     val groupedTestActor = 
>>> actorSystem.actorOf(Props[TestActor].withRouter(FromConfig, 
>>> "groupedtestactor")
>>>     for (i <- 1 to 1000) {
>>>       groupedTestActor ! Hello(i)
>>>     }
>>>   }
>>> }
>>>
>>> class TestActor extends Actor {
>>>   def receive = {
>>>     case Hello(i) => {
>>>       println(s"Hello($i) - begin!")
>>>       Thread.sleep(10000)
>>>       println(s"Hello($i) - end!")
>>>     }
>>>   }
>>> }
>>>
>>> case class Hello(i: Int)
>>>
>>>
>>>
>>> Am I doing something wrong or there is no way to do that?
>>> Mehmet - 
>>>
>>> -- 
>>> >>>>>>>>>> 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 akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Akka Team
>> Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
>> Twitter: @akkateam
>>
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to