Hi Ubaldo,

yes, that's certainly possible. A `Route` is just a regular Java object, so 
you can choose a new `Route` to do the processing for every new request. 
You just need to make sure that you switch out the Route in a thread-safe 
way.

E.g.

val routeHolder = new AtomicReference[Route](initialRoute)
def updateRoute(newRoute: Route): Unit = routeHolder.set(newRoute)
def currentRoute(): Route = routeHolder.get

Http.bindAndHandle(currentRoute(), ...)

Probably even a `volatile var` would suffice if you don't care about the 
old value. The question then becomes how to organize your routes in an 
efficient way but that depends on how your routes and route updates would 
look like.

(You may find answers about this topic on the old spray mailing list as 
well.)

Johannes

On Friday, January 29, 2016 at 4:13:09 PM UTC+1, Ubaldo Taladríz wrote:
>
> Hi, I'm trying to dynamically add http routes to a server without 
> restarting
> Is it possible?
> I'm using Akka-http
>
> Regards
> Ubaldo
>

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