[akka-user] [akka-http] Is it possible to map (rewrite on the server) a HttpRequest and call a bound Route recursively?

2016-02-09 Thread jarl
I have been trying to do that but it seems that I only get Rejected result 
back. Should it work or is there something inside the routing mechanism 
that makes recursive calls impossible?

It looks something like this:

val route = 
...
  ~ path("path") {
  post {
// rewrite
mapRequestContext { ctx =>
  val newRequest = ...
  ctx.withRequest(newRequest)
} { ctx =>
  // call route after rewrite
  route(ctx)
}
  }
}


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


[akka-user] Akka streams file compression

2016-02-09 Thread Richard Rodseth
I'm writing to files and reading from them using FileIO.fromFile and toFile.

Looking to add compression of the files.

This looks promising:
https://github.com/maciej/snappy-flows

The compression is expressed as a Flow[ByteString,ByteString,Unit]

Are there other examples or documentation I should be looking at or is
snappy-flows the way to go?

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


Re: [akka-user] Auto Restart actor when cluster node fails

2016-02-09 Thread Paul Cleary
How do I get an Entity to "stop" to force a restart?

Does the Cluster Shard use the default supervisor strategy?

On Tuesday, February 9, 2016 at 10:14:03 AM UTC-5, Konrad Malawski wrote:
>
> Sounds like you're asking about: 
> http://doc.akka.io/docs/akka/2.4.1/scala/cluster-sharding.html#Remembering_Entities
> Have you seen that feature? :)
>
> -- 
> Cheers,
> Konrad 'ktoso’ Malawski
> Akka  @ Typesafe 
>
> On 9 February 2016 at 16:01:06, Paul Cleary (pcle...@gmail.com 
> ) wrote:
>
> I am using Cluster Sharding to manage certain actors. 
>
> Is it possible that, when a node dies and the shards are re-distributed to 
> other nodes in the cluster, to have the actor automatically start up?
>
>
>
> --
> >> 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.
>
>

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


[akka-user] testing database connection error when using akka persistence

2016-02-09 Thread Tim Pigden
Hi
I have the following scenario:
Program is running using postgres async akka persistence.
My database becomes disconnected (server is turned off or otherwise 
unavailable)
Various things fail.
My database is turned back on
Program stops failing

So far so good - the program seems to recover itself.

But is there any way of creating a unit test for this, short of turning my 
database on and off (I'm testing on a single machine) or otherwise mucking 
around at a system level?

For example can I make the persistence module emulate a disconnected 
situaiton?

Thanks
Tim


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


Re: [akka-user] Auto Restart actor when cluster node fails

2016-02-09 Thread Paul Cleary
Dude, yes, thanks!

On Tuesday, February 9, 2016 at 10:14:03 AM UTC-5, Konrad Malawski wrote:
>
> Sounds like you're asking about: 
> http://doc.akka.io/docs/akka/2.4.1/scala/cluster-sharding.html#Remembering_Entities
> Have you seen that feature? :)
>
> -- 
> Cheers,
> Konrad 'ktoso’ Malawski
> Akka  @ Typesafe 
>
> On 9 February 2016 at 16:01:06, Paul Cleary (pcle...@gmail.com 
> ) wrote:
>
> I am using Cluster Sharding to manage certain actors. 
>
> Is it possible that, when a node dies and the shards are re-distributed to 
> other nodes in the cluster, to have the actor automatically start up?
>
>
>
> --
> >> 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.
>
>

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


Re: [akka-user] Akka Http Websocket

2016-02-09 Thread Endre Varga
Hi Mattieu,

Which version are you using?

-Endre

On Tue, Feb 9, 2016 at 4:34 PM, Matthieu Ravey  wrote:

> Hi,
>
> I have an issue with akka http and websocket. I'm
> using connection.handleWithAsyncHandler and my websocket connection is
> closed just after being opened.
> I've posted the issue on stackoverflow with code snippets:
> http://stackoverflow.com/questions/35274125/websocket-with-async-handler
>
> Thanks,
>
> Matthieu
>
> --
> >> 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.
>

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


[akka-user] Akka Http Websocket

2016-02-09 Thread Matthieu Ravey
Hi,

I have an issue with akka http and websocket. I'm 
using connection.handleWithAsyncHandler and my websocket connection is 
closed just after being opened.
I've posted the issue on stackoverflow with code 
snippets: 
http://stackoverflow.com/questions/35274125/websocket-with-async-handler

Thanks,

Matthieu

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


Re: [akka-user] Auto Restart actor when cluster node fails

2016-02-09 Thread Konrad Malawski
Sounds like you're asking about: 
http://doc.akka.io/docs/akka/2.4.1/scala/cluster-sharding.html#Remembering_Entities
Have you seen that feature? :)

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 9 February 2016 at 16:01:06, Paul Cleary (pclear...@gmail.com) wrote:

I am using Cluster Sharding to manage certain actors.

Is it possible that, when a node dies and the shards are re-distributed to 
other nodes in the cluster, to have the actor automatically start up?



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

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


Re: [akka-user] Re: Akka Persistent Actor Lifecycle

2016-02-09 Thread Patrik Nordwall
You can use receive timeout (see actor section in documentation) and then
stop it after inactivity. If you use Cluster Sharding you should combine
that with the Passivate message as mentioned by Paul (see cluster sharding
section in documentation).
/Patrik
tis 9 feb. 2016 kl. 16:01 skrev Paul Cleary :

> You can use Passivate, which will persist I believe after some period of
> unuse
>
>
> On Tuesday, February 9, 2016 at 9:57:05 AM UTC-5, Mahmoud Atef wrote:
>>
>> Hi,
>>
>> I'm new to AKKA world and I'm working on implementing EventSourcing using
>> the PersistentActors, but I got confused about the life-cycle of those
>> actors. As far as I understand, the default behavior of persistent actors
>> is to stay in the memory until being shutdown, which may overwhelm the
>> memory with tons of actors (actor per entity) living there.
>>
>> I assume that there should be one of two workarounds:
>> 1. Define a pool of actors and shift the context of the actors according
>> to the demand.
>> 2. Shutdown each actor after persisting its events.
>>
>> I cant get any article in that context, so what is the best practice in
>> this case?
>>
> --
> >> 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.
>

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


[akka-user] Re: Akka Persistent Actor Lifecycle

2016-02-09 Thread Paul Cleary
You can use Passivate, which will persist I believe after some period of 
unuse

On Tuesday, February 9, 2016 at 9:57:05 AM UTC-5, Mahmoud Atef wrote:
>
> Hi, 
>
> I'm new to AKKA world and I'm working on implementing EventSourcing using 
> the PersistentActors, but I got confused about the life-cycle of those 
> actors. As far as I understand, the default behavior of persistent actors 
> is to stay in the memory until being shutdown, which may overwhelm the 
> memory with tons of actors (actor per entity) living there.
>
> I assume that there should be one of two workarounds:
> 1. Define a pool of actors and shift the context of the actors according 
> to the demand.
> 2. Shutdown each actor after persisting its events.
>
> I cant get any article in that context, so what is the best practice in 
> this case?
>

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


[akka-user] Auto Restart actor when cluster node fails

2016-02-09 Thread Paul Cleary
I am using Cluster Sharding to manage certain actors.

Is it possible that, when a node dies and the shards are re-distributed to 
other nodes in the cluster, to have the actor automatically start up?



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


[akka-user] Akka Persistent Actor Lifecycle

2016-02-09 Thread Mahmoud Atef
Hi, 

I'm new to AKKA world and I'm working on implementing EventSourcing using 
the PersistentActors, but I got confused about the life-cycle of those 
actors. As far as I understand, the default behavior of persistent actors 
is to stay in the memory until being shutdown, which may overwhelm the 
memory with tons of actors (actor per entity) living there.

I assume that there should be one of two workarounds:
1. Define a pool of actors and shift the context of the actors according to 
the demand.
2. Shutdown each actor after persisting its events.

I cant get any article in that context, so what is the best practice in 
this case?

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


Re: [akka-user] Re: websockets with akka-http *java*

2016-02-09 Thread Johan Andrén
The Java graph DSL isn’t that different, the squiggly arrows (~>) corresponds 
to builder.via and you might
need to manually perform some more builder.add calls to add stages than the 
Scala code does, but you
should be able to create something pretty much like it with Java.

The docs on the Java GraphDSL can be found here:
http://doc.akka.io/docs/akka/2.4.2-RC2/java/stream/stream-graphs.html 


In the sample I gave you the Flow is created by first 
returning a FlowShape from the
block that creates the graph (in Scala the last value is returned, no return 
statement needed), and then passing the
resulting Graph> to Flow.fromGraph.

If it wasn’t for the fact that we needed to pass the outgoing message actorref 
to the connection-actor we could
have just used Flow.fromSinkAndSource(sink, source) to construct it.

—
Johan Andrén
Typesafe -  Reactive apps on the JVM
Twitter: @apnylle

> 9 feb. 2016 kl. 13:51 skrev ash.ta :
> 
> hey johan,
> 
> thanks for explanation.
> my main problem is that i don't know scala and the example is pretty much 
> gibberish for me.
> can you give me a hint about the flow point where sink and source can be 
> called with actorref creation?
> i mean, your java example shows 
> handleWebsocketMessages()
> 
> which receives a mthode returning 
> 
> Flow
> 
> where and how sink and source can be bound to this flow?
> 
> thanks again.
> 
> 
>  
> 
> -- 
> >> 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 a topic in the Google 
> Groups "Akka User List" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/akka-user/qWw79unk_tw/unsubscribe 
> .
> To unsubscribe from this group and all its topics, 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 
> .

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


Re: [akka-user] Re: websockets with akka-http *java*

2016-02-09 Thread ash.ta
hey johan,

thanks for explanation.
my main problem is that i don't know scala and the example is pretty much 
gibberish for me.
can you give me a hint about the flow point where sink and source can be 
called with actorref creation?
i mean, your java example shows 

handleWebsocketMessages()


which receives a mthode returning 

Flow

where and how sink and source can be bound to this flow?

thanks again.


 

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


Re: [akka-user] [Akka Stream] Waiting for stream completion

2016-02-09 Thread Viktor Klang
If the Sink doesn't report when it is done, how would you know it's done?

On Tue, Feb 9, 2016 at 6:11 AM, hbf  wrote:

> Hey Akka Stream'ers,
>
> Is there a simple way to await the completion of stream?
>
> If I have a source that is not yet connected, I can pipe it throw a
> Sink.fold() to materialize it to Future. This allows me to wait
> for the stream to complete. But what if I already have a sink and it
> doesn't materialize to a future?
>
> Thanks!
> Kaspar
>
> --
> >> 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.
>



-- 
Cheers,
√

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