[akka-user] Akka sharding security - is shardRegion custom behavior possible to implement this?

2016-01-12 Thread Rodrigo Boavida
Hi all,

I'm currently implementing an Akka Sharding based infrastructure and found 
a limitation with the solution that potentially becomes a security problem.

There is the web layer (Play) and the data access layer of the akka 
cluster. The web layer communicates through Akka Sharding proxy with 
sharded data query actors - one for each topic (topic name will be in the 
resolver). 

To avoid random invalid query actors to be created through sharding by any 
cluster entity, I would like to validate upfront before the sharding 
actually occurs if the shard region and entity identifier are actually 
valid against my system configuration.

As a matter of principle I would prefer to implement the validation of the 
sharding identifiers on the actual data access layer (the sharded layer), 
the closer to the data, the better.

The problem with this approach is that it seems I have no control over the 
shard region actor and the entity actors creation. What I would need is to 
have some kind of exposure from the sharding API that would allow me 
introduce this validation and have a reply back to the web layer if an 
invalid identifier (shard or entity) is being queried BEFORE the actual 
shard actor gets created somewhere on the cluster.

I have thought about using a Gatekeeper kind of layer on the data access 
layer to introduce the validation, but I believe I would be just moving the 
problem from one place to another: 
1 - Would still be missing authorization on the end receiver node of the 
request, since Akka sharding communication would be the same from the GK to 
the data query topics
2 - "Man in the middle" would be adding network connection overhead - 
instead of reusing the cached connection between the shardRegion proxy on 
the web layer and the shardRegion, on every request we would be potentially 
creating 3 new TCP connections assuming the GK is on a different JVM than 
the destination
3 - "Man in the middle" adding unwanted CPU and Heap overhead with IO 
marshaling and corresponding GC on both the GK JVM and the end data access 
JVM
4 - We wouldn't be really leveraging the balancing nature of akka sharding 
by adding this tunnel layer, neither the smart way akka sharding manages 
connections

All of this to say that would really like to go with some customization of 
akka sharding. I have thought about making the shard and entity resolver 
functions return something invalid that would invalidate the creation but 
is that really possible and would I be able to manage it all the way up to 
the caller?

thanks for having the time to read this and in advance for any comments or 
suggestions.

tnks,
Rod

-- 
>>  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] Dependency problem when updating to akka-http 2.0.1

2016-01-12 Thread rklaehn
OK, I have now narrowed it down a bit more. I removed everything in any way 
related to akka-http, and then added back things until it breaks. It seems 
that the problem only happens when I use MediaTypes.`application/json` in a 
certain way. Now I am even more confused than before.

Here is a repository that reproduces the whole weirdness: 
https://github.com/rklaehn/invaliddependency

I will compile this from my home machine to check that it is not some local 
configuration weirdness. But we have had this happen from two machines at 
work...

On Tuesday, January 12, 2016 at 4:55:31 PM UTC+1, Konrad Malawski wrote:
>
> It should work properly.
> There was a PR refactoring that area, indeed: 
> https://github.com/akka/akka/pull/19066/files
>
> Are you sure you don't have mixed up akka http dependencies or something 
> like that via messy dependencies?
> You mention you looked at dependencyTree so that would show up there 
> though hm...
>
> -- 
> Cheers,
> Konrad 'ktoso’ Malawski
> Akka  @ Typesafe 
>
> On 12 January 2016 at 16:43:30, Rüdiger Klaehn (rkl...@gmail.com 
> ) wrote:
>
> Hi Roland, 
>
> I did a sbt clean, and my colleague even deleted the ivy cache. We 
> also don't know the offending code, since we do not intentionally use 
> anything out of javadsl, such as akka.http.javadsl.model.MediaType. So 
> I am a bit confused. The migration guide does not say anything about 
> MediaType. 
>
> Cheers, 
>
> Rüdiger 
>
> On Tue, Jan 12, 2016 at 4:19 PM, Roland Kuhn  > wrote: 
> > Hi Rüdiger, 
> > 
> > there were some changes in that area, it might help if you show the 
> > offending code. It also looks like you didn’t do a full clean before the 
> > build. Have you checked the migration guide? If we missed this point, 
> please 
> > raise an issue. 
> > 
> > Regards, 
> > 
> > Roland 
> > 
> > 12 jan 2016 kl. 16:00 skrev rklaehn : 
> > 
> > Hi all, 
> > 
> > we are trying out akka-http 2.0.1 with a pretty large code base. After 
> > fixing all compile errors, we get the following dependency error: 
> > 
> > [error] missing or invalid dependency detected while loading class file 
> > 'MediaType.class'. 
> > [error] Could not access type WithFixedCharset in trait 
> > akka.http.javadsl.model.MediaType, 
> > [error] because it (or its dependencies) are missing. Check your build 
> > definition for 
> > [error] missing or conflicting dependencies. (Re-run with 
> `-Ylog-classpath` 
> > to see the problematic classpath.) 
> > [error] A full rebuild may help if 'MediaType.class' was compiled 
> against an 
> > incompatible version of akka.http.javadsl.model.MediaType. 
> > [error] one error found 
> > 
> > I looked at the dependencies using sbt dependencyTree, but did not see 
> > anything obviously wrong. Before I dig deeper, does this problem sound 
> > familiar to anybody? 
> > 
> > Cheers, 
> > 
> > Rüdiger 
> > 
> > -- 
> >>> 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. 
> > 
> > 
> > 
> > 
> > Dr. Roland Kuhn 
> > Akka Tech Lead 
> > Typesafe – Reactive apps on the JVM. 
> > twitter: @rolandkuhn 
> > 
> > 
> > -- 
> >>> 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+...@googlegroups.com . 
> To post to this group, send email to akka...@googlegroups.com 
> . 
> 

Re: [akka-user] future usage within an actor

2016-01-12 Thread Viktor Klang
Hi Ash,

http://doc.akka.io/docs/akka/2.4.1/additional/faq.html#sender___getSender___disappears_when_I_use_Future_in_my_Actor__why_

On Tue, Jan 12, 2016 at 7:10 PM, ash.ta  wrote:

> hi hakkers,
>
> i have two actors: the first one patterns.ask() a message to the second
> one which returns a response:
>
> a snippet osender:
>
> ...
> public PartialFunction receive() {
> return ReceiveBuilder
> .match( Boolean.class, msg -> {
> ActorRef receiver = context().system()
>  .actorOf( Props.create( 
> ReceiveActor.class ), ReceiveActor.class
>  .getSimpleName() );
> Future future = Patterns.ask( receiver, "Hello 
> world", new Timeout( Duration
> .create( 5, "seconds" ) ) );
> Patterns.pipe( future, context().dispatcher() ).to( 
> self() );
> } )
> .match( String.class, msg-> log(msg) )
> .build();
> }
> *...*
>
>
> receiver:
>
> ...
> public PartialFunction receive() {
>
> return ReceiveBuilder.matchAny( msg -> {
> sender().tell( ((String)msg).toUpperCase(), self() );
> } ).build();
> }
> ...
>
>
> all is good, a message is sent and response arrives as expected.
>
> now, i try to change a receiver so that the message handling is done in a
> separate thread:
>
> ...
> public PartialFunction receive() {
> return ReceiveBuilder.matchAny( msg -> {
> Future done= Futures.future( (Callable) () -> 
> ((String)msg).toUpperCase(), context().dispatcher() ) ;
> done.onSuccess( new OnSuccess() {
> @Override
> public void onSuccess( String result ) throws Throwable {
> sender().tell( result, self() );
> }
> }, context().dispatcher() );
> } ).build();
> }
> ...
>
>
> in this case i get the following error:
>
> [akka://main/deadLetters] Message [java.lang.String] from
> Actor[akka://main/user/ReceiveActor#603147641] to
> Actor[akka://main/deadLetters] was not delivered.
>
> it seems that sender() within the future is not recognizable as my sender
> actor anymore.
>
> what do i miss and what is the solution?
>
> thanks!
>
> --
> >> 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.


Re: [akka-user] Dependency problem when updating to akka-http 2.0.1

2016-01-12 Thread rklaehn
Just tried this from home. Also does not work. This is really weird.

$ git clone https://github.com/rklaehn/invaliddependency

$ cd invaliddependency

$ sbt clean compile

[info] Loading project definition from 
/Users/rklaehn/projects_git/rklaehn/invaliddependency/project

[info] Set current project to invaliddependency (in build 
file:/Users/rklaehn/projects_git/rklaehn/invaliddependency/)

[success] Total time: 0 s, completed Jan 12, 2016 8:18:55 PM

[info] Updating 
{file:/Users/rklaehn/projects_git/rklaehn/invaliddependency/}invaliddependency...

[info] Resolving jline#jline;2.12.1 ...

[info] Done updating.

[info] Compiling 1 Scala source to 
/Users/rklaehn/projects_git/rklaehn/invaliddependency/target/scala-2.11/classes...

[error] missing or invalid dependency detected while loading class file 
'MediaType.class'.

[error] Could not access type WithFixedCharset in trait 
akka.http.javadsl.model.MediaType,

[error] because it (or its dependencies) are missing. Check your build 
definition for

[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` 
to see the problematic classpath.)

[error] A full rebuild may help if 'MediaType.class' was compiled against 
an incompatible version of akka.http.javadsl.model.MediaType.

[error] one error found

[error] (compile:compileIncremental) Compilation failed

[error] Total time: 2 s, completed Jan 12, 2016 8:18:57 PM
On Tuesday, January 12, 2016 at 7:58:27 PM UTC+1, rklaehn wrote:
>
> OK, I have now narrowed it down a bit more. I removed everything in any 
> way related to akka-http, and then added back things until it breaks. It 
> seems that the problem only happens when I use 
> MediaTypes.`application/json` in a certain way. Now I am even more confused 
> than before.
>
> Here is a repository that reproduces the whole weirdness: 
> https://github.com/rklaehn/invaliddependency
>
> I will compile this from my home machine to check that it is not some 
> local configuration weirdness. But we have had this happen from two 
> machines at work...
>
> On Tuesday, January 12, 2016 at 4:55:31 PM UTC+1, Konrad Malawski wrote:
>>
>> It should work properly.
>> There was a PR refactoring that area, indeed: 
>> https://github.com/akka/akka/pull/19066/files
>>
>> Are you sure you don't have mixed up akka http dependencies or something 
>> like that via messy dependencies?
>> You mention you looked at dependencyTree so that would show up there 
>> though hm...
>>
>> -- 
>> Cheers,
>> Konrad 'ktoso’ Malawski
>> Akka  @ Typesafe 
>>
>> On 12 January 2016 at 16:43:30, Rüdiger Klaehn (rkl...@gmail.com) wrote:
>>
>> Hi Roland, 
>>
>> I did a sbt clean, and my colleague even deleted the ivy cache. We 
>> also don't know the offending code, since we do not intentionally use 
>> anything out of javadsl, such as akka.http.javadsl.model.MediaType. So 
>> I am a bit confused. The migration guide does not say anything about 
>> MediaType. 
>>
>> Cheers, 
>>
>> Rüdiger 
>>
>> On Tue, Jan 12, 2016 at 4:19 PM, Roland Kuhn  wrote: 
>> > Hi Rüdiger, 
>> > 
>> > there were some changes in that area, it might help if you show the 
>> > offending code. It also looks like you didn’t do a full clean before 
>> the 
>> > build. Have you checked the migration guide? If we missed this point, 
>> please 
>> > raise an issue. 
>> > 
>> > Regards, 
>> > 
>> > Roland 
>> > 
>> > 12 jan 2016 kl. 16:00 skrev rklaehn : 
>> > 
>> > Hi all, 
>> > 
>> > we are trying out akka-http 2.0.1 with a pretty large code base. After 
>> > fixing all compile errors, we get the following dependency error: 
>> > 
>> > [error] missing or invalid dependency detected while loading class file 
>> > 'MediaType.class'. 
>> > [error] Could not access type WithFixedCharset in trait 
>> > akka.http.javadsl.model.MediaType, 
>> > [error] because it (or its dependencies) are missing. Check your build 
>> > definition for 
>> > [error] missing or conflicting dependencies. (Re-run with 
>> `-Ylog-classpath` 
>> > to see the problematic classpath.) 
>> > [error] A full rebuild may help if 'MediaType.class' was compiled 
>> against an 
>> > incompatible version of akka.http.javadsl.model.MediaType. 
>> > [error] one error found 
>> > 
>> > I looked at the dependencies using sbt dependencyTree, but did not see 
>> > anything obviously wrong. Before I dig deeper, does this problem sound 
>> > familiar to anybody? 
>> > 
>> > Cheers, 
>> > 
>> > Rüdiger 
>> > 
>> > -- 
>> >>> 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] Asking a node to leave using akka-cluster command-line tool.

2016-01-12 Thread joseph
Hi,

I have a 2-node akka cluster. When deploying updated code, the nodes are 
restarted one after the other with some time gap in between. This seems to 
be causing Unreachable/Quarantine issues. So, I want to ask each node to 
LEAVE the cluster before it is restarted. I am using the akka-cluster 
command-line tool for this.

joseph@gw01:~$ akka-cluster app01.stg  leave akka.tcp:
//sys...@app01.stg:2551
Scheduling akka.tcp://sys...@app01.stg:2551 to LEAVE cluster
joseph@gw01:~$ akka-cluster app02.stg  leader
Checking leader status
akka.tcp://system@app01:2551



It says that it's Scheduling to LEAVE the cluster, but doesn't actually 
leave the cluster. I tried asking both the Leader and non-leader to leave, 
but they don't leave even after half an hour.
Is there some way I can get them to leave immediately?
Is there some restriction that the Leader cannot leave the cluster? I 
expected that it would transfer leadership to the other node and leave.

Thanks.
Joseph

-- 
>>  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] future usage within an actor

2016-01-12 Thread ash.ta
hi again,

thanks for your prompt response.

in such case, what in your opinion is the right way to implement something 
like async calls to db? to use the async driver from an actor with a 
dedicated separate dispatcher
and block the async call itself?

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.


Re: [akka-user] Dependency problem when updating to akka-http 2.0.1

2016-01-12 Thread Konrad Malawski
For reference, this is now tracked at:
https://github.com/akka/akka/issues/19418
and
https://issues.scala-lang.org/browse/SI-9621

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

On 12 January 2016 at 20:19:56, rklaehn (rkla...@gmail.com) wrote:

Just tried this from home. Also does not work. This is really weird.

$ git clone https://github.com/rklaehn/invaliddependency

$ cd invaliddependency

$ sbt clean compile

[info] Loading project definition from 
/Users/rklaehn/projects_git/rklaehn/invaliddependency/project

[info] Set current project to invaliddependency (in build 
file:/Users/rklaehn/projects_git/rklaehn/invaliddependency/)

[success] Total time: 0 s, completed Jan 12, 2016 8:18:55 PM

[info] Updating 
{file:/Users/rklaehn/projects_git/rklaehn/invaliddependency/}invaliddependency...

[info] Resolving jline#jline;2.12.1 ...

[info] Done updating.

[info] Compiling 1 Scala source to 
/Users/rklaehn/projects_git/rklaehn/invaliddependency/target/scala-2.11/classes...

[error] missing or invalid dependency detected while loading class file 
'MediaType.class'.

[error] Could not access type WithFixedCharset in trait 
akka.http.javadsl.model.MediaType,

[error] because it (or its dependencies) are missing. Check your build 
definition for

[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to 
see the problematic classpath.)

[error] A full rebuild may help if 'MediaType.class' was compiled against an 
incompatible version of akka.http.javadsl.model.MediaType.

[error] one error found

[error] (compile:compileIncremental) Compilation failed

[error] Total time: 2 s, completed Jan 12, 2016 8:18:57 PM

On Tuesday, January 12, 2016 at 7:58:27 PM UTC+1, rklaehn wrote:
OK, I have now narrowed it down a bit more. I removed everything in any way 
related to akka-http, and then added back things until it breaks. It seems that 
the problem only happens when I use MediaTypes.`application/json` in a certain 
way. Now I am even more confused than before.

Here is a repository that reproduces the whole weirdness: 
https://github.com/rklaehn/invaliddependency

I will compile this from my home machine to check that it is not some local 
configuration weirdness. But we have had this happen from two machines at 
work...

On Tuesday, January 12, 2016 at 4:55:31 PM UTC+1, Konrad Malawski wrote:
It should work properly.
There was a PR refactoring that area, indeed: 
https://github.com/akka/akka/pull/19066/files

Are you sure you don't have mixed up akka http dependencies or something like 
that via messy dependencies?
You mention you looked at dependencyTree so that would show up there though 
hm...

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

On 12 January 2016 at 16:43:30, Rüdiger Klaehn (rkl...@gmail.com) wrote:

Hi Roland,

I did a sbt clean, and my colleague even deleted the ivy cache. We
also don't know the offending code, since we do not intentionally use
anything out of javadsl, such as akka.http.javadsl.model.MediaType. So
I am a bit confused. The migration guide does not say anything about
MediaType.

Cheers,

Rüdiger

On Tue, Jan 12, 2016 at 4:19 PM, Roland Kuhn  wrote:
> Hi Rüdiger,
>
> there were some changes in that area, it might help if you show the
> offending code. It also looks like you didn’t do a full clean before the
> build. Have you checked the migration guide? If we missed this point, please
> raise an issue.
>
> Regards,
>
> Roland
>
> 12 jan 2016 kl. 16:00 skrev rklaehn :
>
> Hi all,
>
> we are trying out akka-http 2.0.1 with a pretty large code base. After
> fixing all compile errors, we get the following dependency error:
>
> [error] missing or invalid dependency detected while loading class file
> 'MediaType.class'.
> [error] Could not access type WithFixedCharset in trait
> akka.http.javadsl.model.MediaType,
> [error] because it (or its dependencies) are missing. Check your build
> definition for
> [error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath`
> to see the problematic classpath.)
> [error] A full rebuild may help if 'MediaType.class' was compiled against an
> incompatible version of akka.http.javadsl.model.MediaType.
> [error] one error found
>
> I looked at the dependencies using sbt dependencyTree, but did not see
> anything obviously wrong. Before I dig deeper, does this problem sound
> familiar to anybody?
>
> Cheers,
>
> Rüdiger
>
> --
>>> 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 

[akka-user] Dependency problem when updating to akka-http 2.0.1

2016-01-12 Thread rklaehn
Hi all,

we are trying out akka-http 2.0.1 with a pretty large code base. After 
fixing all compile errors, we get the following dependency error:

[error] missing or invalid dependency detected while loading class file 
'MediaType.class'.
[error] Could not access type WithFixedCharset in trait 
akka.http.javadsl.model.MediaType,
[error] because it (or its dependencies) are missing. Check your build 
definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` 
to see the problematic classpath.)
[error] A full rebuild may help if 'MediaType.class' was compiled against 
an incompatible version of akka.http.javadsl.model.MediaType.
[error] one error found

I looked at the dependencies using sbt dependencyTree, but did not see 
anything obviously wrong. Before I dig deeper, does this problem sound 
familiar to anybody?

Cheers,

Rüdiger

-- 
>>  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] Dependency problem when updating to akka-http 2.0.1

2016-01-12 Thread Roland Kuhn
Hi Rüdiger,

there were some changes in that area, it might help if you show the offending 
code. It also looks like you didn’t do a full clean before the build. Have you 
checked the migration guide? If we missed this point, please raise an issue.

Regards,

Roland

> 12 jan 2016 kl. 16:00 skrev rklaehn :
> 
> Hi all,
> 
> we are trying out akka-http 2.0.1 with a pretty large code base. After fixing 
> all compile errors, we get the following dependency error:
> 
> [error] missing or invalid dependency detected while loading class file 
> 'MediaType.class'.
> [error] Could not access type WithFixedCharset in trait 
> akka.http.javadsl.model.MediaType,
> [error] because it (or its dependencies) are missing. Check your build 
> definition for
> [error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` 
> to see the problematic classpath.)
> [error] A full rebuild may help if 'MediaType.class' was compiled against an 
> incompatible version of akka.http.javadsl.model.MediaType.
> [error] one error found
> 
> I looked at the dependencies using sbt dependencyTree, but did not see 
> anything obviously wrong. Before I dig deeper, does this problem sound 
> familiar to anybody?
> 
> Cheers,
> 
> Rüdiger
> 
> -- 
> >> 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 
> .



Dr. Roland Kuhn
Akka Tech Lead
Typesafe  – Reactive apps on the JVM.
twitter: @rolandkuhn
 

-- 
>>  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] Service discovery?

2016-01-12 Thread Igor Katz
 

Hi,

We are going to use Akka-HTTP as IPC in our new distributed system that is 
based on microservice architecture. How to perform Service discovery for 
akka-stream/akka-http in distributed system? What is the best way to 
implement this?
Thanks,
Igor

-- 
>>  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: Accessing materializer within a GraphStage

2016-01-12 Thread Johan Andrén
Hi Francesco,

In general the GraphStage is meant to encapsulate smaller
graph transformations than sub-graphs and the flow API and 
GraphDSL is the way to go combine graphs. So, one thing 
might be to reconsider if perhaps your GraphStage is doing
too many things at one time and you could separate concerns
into smaller parts which can then more freely be combined.

If you have already considered this but feel sure about your
design, then the materializer is available inside your graph stage
logic through the materializer method.

It would be very interesting to hear about the use case!

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

On Monday, December 7, 2015 at 4:37:52 PM UTC+1, Francesco Di Muccio wrote:
>
> Hi,
>
> in all the other stages it is possible to get the Materializer from the 
> LifecycleContext to materialize sub-graphs, but in GraphStage it isn't 
> possible, is it by design? 
>
> What is the best way to materialize a sub-graph within a GraphStage? For 
> now my solution is to use a Materializer passed as an implicit parameter to 
> the stage.
>
> Regards,
> Francesco.
>

-- 
>>  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] Dependency problem when updating to akka-http 2.0.1

2016-01-12 Thread Rüdiger Klaehn
Hi Roland,

I did a sbt clean, and my colleague even deleted the ivy cache. We
also don't know the offending code, since we do not intentionally use
anything out of javadsl, such as akka.http.javadsl.model.MediaType. So
I am a bit confused. The migration guide does not say anything about
MediaType.

Cheers,

Rüdiger

On Tue, Jan 12, 2016 at 4:19 PM, Roland Kuhn  wrote:
> Hi Rüdiger,
>
> there were some changes in that area, it might help if you show the
> offending code. It also looks like you didn’t do a full clean before the
> build. Have you checked the migration guide? If we missed this point, please
> raise an issue.
>
> Regards,
>
> Roland
>
> 12 jan 2016 kl. 16:00 skrev rklaehn :
>
> Hi all,
>
> we are trying out akka-http 2.0.1 with a pretty large code base. After
> fixing all compile errors, we get the following dependency error:
>
> [error] missing or invalid dependency detected while loading class file
> 'MediaType.class'.
> [error] Could not access type WithFixedCharset in trait
> akka.http.javadsl.model.MediaType,
> [error] because it (or its dependencies) are missing. Check your build
> definition for
> [error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath`
> to see the problematic classpath.)
> [error] A full rebuild may help if 'MediaType.class' was compiled against an
> incompatible version of akka.http.javadsl.model.MediaType.
> [error] one error found
>
> I looked at the dependencies using sbt dependencyTree, but did not see
> anything obviously wrong. Before I dig deeper, does this problem sound
> familiar to anybody?
>
> Cheers,
>
> Rüdiger
>
> --
>>> 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.
>
>
>
>
> Dr. Roland Kuhn
> Akka Tech Lead
> Typesafe – Reactive apps on the JVM.
> twitter: @rolandkuhn
>
>
> --
>>> 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] Dependency problem when updating to akka-http 2.0.1

2016-01-12 Thread Konrad Malawski
It should work properly.
There was a PR refactoring that area, indeed: 
https://github.com/akka/akka/pull/19066/files

Are you sure you don't have mixed up akka http dependencies or something like 
that via messy dependencies?
You mention you looked at dependencyTree so that would show up there though 
hm...

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

On 12 January 2016 at 16:43:30, Rüdiger Klaehn (rkla...@gmail.com) wrote:

Hi Roland,  

I did a sbt clean, and my colleague even deleted the ivy cache. We  
also don't know the offending code, since we do not intentionally use  
anything out of javadsl, such as akka.http.javadsl.model.MediaType. So  
I am a bit confused. The migration guide does not say anything about  
MediaType.  

Cheers,  

Rüdiger  

On Tue, Jan 12, 2016 at 4:19 PM, Roland Kuhn  wrote:  
> Hi Rüdiger,  
>  
> there were some changes in that area, it might help if you show the  
> offending code. It also looks like you didn’t do a full clean before the  
> build. Have you checked the migration guide? If we missed this point, please  
> raise an issue.  
>  
> Regards,  
>  
> Roland  
>  
> 12 jan 2016 kl. 16:00 skrev rklaehn :  
>  
> Hi all,  
>  
> we are trying out akka-http 2.0.1 with a pretty large code base. After  
> fixing all compile errors, we get the following dependency error:  
>  
> [error] missing or invalid dependency detected while loading class file  
> 'MediaType.class'.  
> [error] Could not access type WithFixedCharset in trait  
> akka.http.javadsl.model.MediaType,  
> [error] because it (or its dependencies) are missing. Check your build  
> definition for  
> [error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath`  
> to see the problematic classpath.)  
> [error] A full rebuild may help if 'MediaType.class' was compiled against an  
> incompatible version of akka.http.javadsl.model.MediaType.  
> [error] one error found  
>  
> I looked at the dependencies using sbt dependencyTree, but did not see  
> anything obviously wrong. Before I dig deeper, does this problem sound  
> familiar to anybody?  
>  
> Cheers,  
>  
> Rüdiger  
>  
> --  
>>> 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.  
>  
>  
>  
>  
> Dr. Roland Kuhn  
> Akka Tech Lead  
> Typesafe – Reactive apps on the JVM.  
> twitter: @rolandkuhn  
>  
>  
> --  
>>> 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.  

-- 
>>  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] future usage within an actor

2016-01-12 Thread ash.ta
hi hakkers,

i have two actors: the first one patterns.ask() a message to the second one 
which returns a response:

a snippet osender: 

...
public PartialFunction receive() {
return ReceiveBuilder
.match( Boolean.class, msg -> {
ActorRef receiver = context().system()
 .actorOf( Props.create( 
ReceiveActor.class ), ReceiveActor.class
 .getSimpleName() );
Future future = Patterns.ask( receiver, "Hello 
world", new Timeout( Duration
.create( 5, "seconds" ) ) );
Patterns.pipe( future, context().dispatcher() ).to( self() 
);
} )
.match( String.class, msg-> log(msg) )
.build();
}
*...*


receiver:

...
public PartialFunction receive() {

return ReceiveBuilder.matchAny( msg -> {
sender().tell( ((String)msg).toUpperCase(), self() );
} ).build();
}
...


all is good, a message is sent and response arrives as expected.

now, i try to change a receiver so that the message handling is done in a 
separate thread:

...
public PartialFunction receive() {
return ReceiveBuilder.matchAny( msg -> { 
Future done= Futures.future( (Callable) () -> 
((String)msg).toUpperCase(), context().dispatcher() ) ;
done.onSuccess( new OnSuccess() {
@Override
public void onSuccess( String result ) throws Throwable {
sender().tell( result, self() );
}
}, context().dispatcher() );
} ).build();
}
...


in this case i get the following error: 

[akka://main/deadLetters] Message [java.lang.String] from 
Actor[akka://main/user/ReceiveActor#603147641] to 
Actor[akka://main/deadLetters] was not delivered.

it seems that sender() within the future is not recognizable as my sender 
actor anymore.

what do i miss and what is the solution? 

thanks!

-- 
>>  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] Service discovery?

2016-01-12 Thread Michael Frank

On 01/12/16 07:28, Igor Katz wrote:


Hi,

We are going to use Akka-HTTP as IPC in our new distributed system 
that is based on microservice architecture. How to perform Service 
discovery for akka-stream/akka-http in distributed system? What is the 
best way to implement this?



what are your requirements?

-Michael

--

 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] Does akka streams support a getDataBytes() with context flow?

2016-01-12 Thread john . vieten


Isn't the following case typical for dealing with Http().superPool(...) flows?
The superPool flow lets me nicely attach context to the HttResponse.

Now I do not want to materialize the  getDataBytes Source right away but pass 
it to flatMapConcat.
Like in the following pseudo java code: 

1) Flow, Pair, BoxedUnit> 
flow = httpClient.request();
2) Flow byteStringFlow = 
responseFlow.flatMapConcat(pair -> {
3)   // How to also pass pair.second() back?
4)   return pair.first().get().entity().getDataBytes();
5) });


In the above code I would like to also pass the context in pair.second() 
downstream. I guess this is not possible with the simple flows api?
Does akka streams support a getDataBytes() with context flow?


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