Re: [akka-user] Activator: akka-stream-scala template compilation error

2015-05-02 Thread Konrad Malawski
Thanks for pointing this out - good catch!
Fixed: https://github.com/typesafehub/activator-akka-stream-scala/pull/25

// Note to self, doubleckeck if travis actually works as expected on these
repos.

On Sat, May 2, 2015 at 1:50 AM, Richard Rodseth rrods...@gmail.com wrote:

 You're probably aware of this already:

 [error]
 /Users/rrodseth/dev/samples/akka-stream-scala/src/main/scala/sample/stream/GroupLogFile.scala:34:
 too many arguments for method mapAsync: (parallelism: Int)(f: ((String,
 akka.stream.scaladsl.Source[String,Unit])) =
 scala.concurrent.Future[T])akka.stream.scaladsl.Source[T,Unit]

 [error]   mapAsync(parallelism = 5, {

 [error]   ^

 --
  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 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




-- 
Cheers,
Konrad 'ktoso' Malawski
Akka http://akka.io/ @ Typesafe http://typesafe.com/

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka Stream quick start guide not working

2015-05-02 Thread Konrad Malawski
Hi Simone!
All examples in the docs are compiled and tested before we release them, so let 
ma assure you the code is valid.

The entire code is listed here if you’d like to have a look at the complete 
file: 
https://github.com/akka/akka/blob/release-2.3-dev/akka-docs-dev/rst/scala/code/docs/stream/TwitterStreamQuickstartDocSpec.scala

Can you paste the code snippet which you have trouble getting to work?
Are you sure you are using the `akka.stream.scaladsl.FlowGraph` and not the 
javadsl one? (javadsl understandably does not have Implicits).

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

On 2 May 2015 at 20:01:07, Simone Scarduzio (scardu...@gmail.com) wrote:

Hi all,

I'm a beginner with Akka Stream, but I found a couple of problems trying to 
compile the quick start example provided in the docs.
FlowGraph does not have a closed() method
FlowGraph.Implicits does not exist
I'm using this sbt dependency:

com.typesafe.akka %% akka-stream-experimental % 1.0-RC2


Thanks for your help,

_Simone
--
 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 http://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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Akka Stream quick start guide not working

2015-05-02 Thread Simone Scarduzio
Hi all,

I'm a beginner with Akka Stream, but I found a couple of problems trying to 
compile the quick start example 
http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC2/scala/stream-quickstart.html#stream-quickstart-scalaprovided
 
in the docs.

   1. FlowGraph does not have a closed() method
   2. FlowGraph.Implicits does not exist

I'm using this sbt dependency:

com.typesafe.akka %% akka-stream-experimental % 1.0-RC2


Thanks for your help,

_Simone

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka Stream quick start guide not working

2015-05-02 Thread Simone Scarduzio
Hey Konrad,

Thanks for the fast reply. I made a summary of my problem in this gist.

https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b

Also the code from github is not working, it must be some problem with my
environment :(

_S

On Sat, May 2, 2015 at 7:04 PM, Konrad Malawski 
konrad.malaw...@typesafe.com wrote:

 Hi Simone!
 All examples in the docs are compiled and tested before we release them,
 so let ma assure you the code is valid.

 The entire code is listed here if you’d like to have a look at the
 complete file:

 https://github.com/akka/akka/blob/release-2.3-dev/akka-docs-dev/rst/scala/code/docs/stream/TwitterStreamQuickstartDocSpec.scala

 Can you paste the code snippet which you have trouble getting to work?
 Are you sure you are using the `akka.stream.scaladsl.FlowGraph` and not
 the javadsl one? (javadsl understandably does not have Implicits).

 --
 Cheers,
 Konrad 'ktoso’ Malawski
 Akka http://akka.io @ Typesafe http://typesafe.com

 On 2 May 2015 at 20:01:07, Simone Scarduzio (scardu...@gmail.com) wrote:

 Hi all,

 I'm a beginner with Akka Stream, but I found a couple of problems trying
 to compile the quick start example
 http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC2/scala/stream-quickstart.html#stream-quickstart-scala
 provided in the docs.

1. FlowGraph does not have a closed() method
2. FlowGraph.Implicits does not exist

 I'm using this sbt dependency:

 com.typesafe.akka %% akka-stream-experimental % 1.0-RC2


 Thanks for your help,

 _Simone
  --
  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 http://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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka Stream quick start guide not working

2015-05-02 Thread Konrad Malawski
Seems you forgot to extend RawDocument in Document, which manifested itself in 
being unable to wire up flows of not-compatible types.
I forked and fixed the minor typos in your code: 
https://gist.github.com/ktoso/8140969c4aead4103317

Happy hakking, I hope you’ll enjoy Akka Streams as much as we do :-)


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

On 2 May 2015 at 20:24:40, Simone Scarduzio (scardu...@gmail.com) wrote:

Hey Konrad, 

Thanks for the fast reply. I made a summary of my problem in this gist.

https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b

Also the code from github is not working, it must be some problem with my 
environment :(

_S

On Sat, May 2, 2015 at 7:04 PM, Konrad Malawski konrad.malaw...@typesafe.com 
wrote:
Hi Simone!
All examples in the docs are compiled and tested before we release them, so let 
ma assure you the code is valid.

The entire code is listed here if you’d like to have a look at the complete 
file: 
https://github.com/akka/akka/blob/release-2.3-dev/akka-docs-dev/rst/scala/code/docs/stream/TwitterStreamQuickstartDocSpec.scala

Can you paste the code snippet which you have trouble getting to work?
Are you sure you are using the `akka.stream.scaladsl.FlowGraph` and not the 
javadsl one? (javadsl understandably does not have Implicits).

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

On 2 May 2015 at 20:01:07, Simone Scarduzio (scardu...@gmail.com) wrote:

Hi all,

I'm a beginner with Akka Stream, but I found a couple of problems trying to 
compile the quick start example provided in the docs.
FlowGraph does not have a closed() method
FlowGraph.Implicits does not exist
I'm using this sbt dependency:

com.typesafe.akka %% akka-stream-experimental % 1.0-RC2


Thanks for your help,

_Simone
--
 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 http://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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka Stream quick start guide not working

2015-05-02 Thread Simone Scarduzio
Hi Konrad,

Unfortunately I have problems to see your changes, when I click your gist
link I see identical code to mine.

_S

On Sat, May 2, 2015 at 7:38 PM, Konrad Malawski 
konrad.malaw...@typesafe.com wrote:

 Seems you forgot to extend RawDocument in Document, which manifested
 itself in being unable to wire up flows of not-compatible types.
 I forked and fixed the minor typos in your code:
 https://gist.github.com/ktoso/8140969c4aead4103317

 https://gist.github.com/ktoso/8140969c4aead4103317
 Happy hakking, I hope you’ll enjoy Akka Streams as much as we do :-)

 https://gist.github.com/ktoso/8140969c4aead4103317

 https://gist.github.com/ktoso/8140969c4aead4103317
 --
 Cheers,
 Konrad 'ktoso’ Malawski
 Akka http://akka.io @ Typesafe http://typesafe.com

 On 2 May 2015 at 20:24:40, Simone Scarduzio (scardu...@gmail.com) wrote:

 Hey Konrad,

 Thanks for the fast reply. I made a summary of my problem in this gist.

 https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b

 Also the code from github is not working, it must be some problem with my
 environment :(

 _S

 On Sat, May 2, 2015 at 7:04 PM, Konrad Malawski 
 konrad.malaw...@typesafe.com wrote:

  Hi Simone!
  All examples in the docs are compiled and tested before we release them,
 so let ma assure you the code is valid.

  The entire code is listed here if you’d like to have a look at the
 complete file:

 https://github.com/akka/akka/blob/release-2.3-dev/akka-docs-dev/rst/scala/code/docs/stream/TwitterStreamQuickstartDocSpec.scala

  Can you paste the code snippet which you have trouble getting to work?
  Are you sure you are using the `akka.stream.scaladsl.FlowGraph` and not
 the javadsl one? (javadsl understandably does not have Implicits).

 --
   Cheers,
 Konrad 'ktoso’ Malawski
 Akka http://akka.io @ Typesafe http://typesafe.com

 On 2 May 2015 at 20:01:07, Simone Scarduzio (scardu...@gmail.com) wrote:

  Hi all,

 I'm a beginner with Akka Stream, but I found a couple of problems trying
 to compile the quick start example
 http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC2/scala/stream-quickstart.html#stream-quickstart-scala
 provided in the docs.

1. FlowGraph does not have a closed() method
2. FlowGraph.Implicits does not exist

 I'm using this sbt dependency:

 com.typesafe.akka %% akka-stream-experimental % 1.0-RC2


 Thanks for your help,

 _Simone
  --
  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 http://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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka Stream quick start guide not working

2015-05-02 Thread Simone Scarduzio
Hey nevermind, I made it work!

https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b#file-workinggraph-scala

Wohoo! ;)

IntelliJ still gives me all kinds of errors. I guess it's about corrupted
cache.
Once again, my golden rule is confirmed: only trust sbt compile output.

_S


On Sat, May 2, 2015 at 8:47 PM, Simone Scarduzio scardu...@gmail.com
wrote:

 Hi Konrad,

 Unfortunately I have problems to see your changes, when I click your gist
 link I see identical code to mine.

 _S

 On Sat, May 2, 2015 at 7:38 PM, Konrad Malawski 
 konrad.malaw...@typesafe.com wrote:

 Seems you forgot to extend RawDocument in Document, which manifested
 itself in being unable to wire up flows of not-compatible types.
 I forked and fixed the minor typos in your code:
 https://gist.github.com/ktoso/8140969c4aead4103317

 https://gist.github.com/ktoso/8140969c4aead4103317
 Happy hakking, I hope you’ll enjoy Akka Streams as much as we do :-)

 https://gist.github.com/ktoso/8140969c4aead4103317

 https://gist.github.com/ktoso/8140969c4aead4103317
 --
 Cheers,
 Konrad 'ktoso’ Malawski
 Akka http://akka.io @ Typesafe http://typesafe.com

 On 2 May 2015 at 20:24:40, Simone Scarduzio (scardu...@gmail.com) wrote:

 Hey Konrad,

 Thanks for the fast reply. I made a summary of my problem in this gist.

 https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b

 Also the code from github is not working, it must be some problem with my
 environment :(

 _S

 On Sat, May 2, 2015 at 7:04 PM, Konrad Malawski 
 konrad.malaw...@typesafe.com wrote:

  Hi Simone!
  All examples in the docs are compiled and tested before we release
 them, so let ma assure you the code is valid.

  The entire code is listed here if you’d like to have a look at the
 complete file:

 https://github.com/akka/akka/blob/release-2.3-dev/akka-docs-dev/rst/scala/code/docs/stream/TwitterStreamQuickstartDocSpec.scala

  Can you paste the code snippet which you have trouble getting to work?
  Are you sure you are using the `akka.stream.scaladsl.FlowGraph` and not
 the javadsl one? (javadsl understandably does not have Implicits).

 --
   Cheers,
 Konrad 'ktoso’ Malawski
 Akka http://akka.io @ Typesafe http://typesafe.com

 On 2 May 2015 at 20:01:07, Simone Scarduzio (scardu...@gmail.com) wrote:

  Hi all,

 I'm a beginner with Akka Stream, but I found a couple of problems trying
 to compile the quick start example
 http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC2/scala/stream-quickstart.html#stream-quickstart-scala
 provided in the docs.

1. FlowGraph does not have a closed() method
2. FlowGraph.Implicits does not exist

 I'm using this sbt dependency:

 com.typesafe.akka %% akka-stream-experimental % 1.0-RC2


 Thanks for your help,

 _Simone
  --
  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 http://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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Testing Supervisor Strategies

2015-05-02 Thread Harit Himanshu
I am very new to `Akka` and using `Java` to program my system. 

**Problem definition**  
- I have a `TenantMonitor` which when receives `TenantMonitorMessage()`, 
starts a new actor `DiskMonitorActor`.  
- The `DiskMonitorActor` may fail for various reasons and may throw 
`DiskException`. The `DiskMonitorActor` has been Unit Tested.  

**What I need?**  
- I want to test behavior `TenantMonitorActor`, so that when 
`DiskException` happens, it takes correct action like `stop()`, `resume()` 
or any (depending upon what my application may need)  

**What I tried?**  
Based on the [documentation][1], the closest I could perform is the section 
called **Expecting Log Messages**.   

**Where I need help?**  
- While I understand the expecting the correct error log is important, it 
just asserts first part, that exception is thrown and is logged correctly, 
but does not help in asserting that right `strategy` is called  


*TenantMonitorActor*

public class TenantMonitorActor extends UntypedActor {

  public static final String DISK_MONITOR = diskMonitor;
  private static final String assetsLocationKey = 
tenant.assetsLocation;
  private static final String schedulerKey = 
monitoring.tenant.disk.schedule.seconds;
  private static final String thresholdPercentKey = 
monitoring.tenant.disk.threshold.percent;

  private final LoggingAdapter logging = 
Logging.getLogger(getContext().system(), this);
  private final Config config;

  private TenantMonitorActor(final Config config) {
this.config = config;
  }

  private static final SupervisorStrategy strategy =
  new OneForOneStrategy(1, Duration.create(1, TimeUnit.SECONDS),
new FunctionThrowable, Directive() {

  public Directive apply(final Throwable 
param) throws Exception {
if (param instanceof DiskException) {
  return stop();
}
return restart();
  }
});

  public static Props props(final Config config) {
return Props.create(new CreatorTenantMonitorActor(){
  public TenantMonitorActor create() throws Exception {
return new TenantMonitorActor(config);
  }
});
  }

  @Override
  public void onReceive(final Object message) throws Exception {
if (message instanceof TenantMonitorMessage) {
  logging.info(Tenant Monitor Setup);
  setupDiskMonitoring();
}
  }

  @Override
  public SupervisorStrategy supervisorStrategy() {
return strategy;
  }



  private void setupDiskMonitoring() {
final ActorRef diskMonitorActorRef = getDiskMonitorActorRef(config);

final FiniteDuration start = Duration.create(0, TimeUnit.SECONDS);
final FiniteDuration recurring = 
Duration.create(config.getInt(schedulerKey),
 TimeUnit.SECONDS);

final ActorSystem system = getContext().system();
system.scheduler()
.schedule(start, recurring, diskMonitorActorRef,
  new DiskMonitorMessage(), system.dispatcher(), null);
  }

  private ActorRef getDiskMonitorActorRef(final Config monitoringConf) {
final Props diskMonitorProps =
DiskMonitorActor.props(new 
File(monitoringConf.getString(assetsLocationKey)),
  
 monitoringConf.getLong(thresholdPercentKey));
return getContext().actorOf(diskMonitorProps, DISK_MONITOR);

  }
}

*Test*

  @Test
  public void testActorForNonExistentLocation() throws Exception {
final MapString, String configValues =
Collections.singletonMap(tenant.assetsLocation, 
/non/existentLocation);
final Config config = mergeConfig(configValues);

new JavaTestKit(system) {{
  assertEquals(system, system.name());

  final Props props = TenantMonitorActor.props(config);
  final ActorRef supervisor = system.actorOf(props, supervisor);
  new EventFilterVoid(DiskException.class) {

@Override
protected Void run() {
  supervisor.tell(new TenantMonitorMessage(), 
ActorRef.noSender());
  return null;
}
  
}.from(akka://system/user/supervisor/diskMonitor).occurrences(1).exec();

}};
  }

  [1]: http://doc.akka.io/docs/akka/snapshot/java/testing.html#akka-testkit

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

Re: [akka-user] Akka Stream quick start guide not working

2015-05-02 Thread Simone Scarduzio
Yep, I got Intellij working too at the end.
 My build.sbt had this enablePlugins(JavaAppPackaging) line which
failed and prevented the internal build system from downloading the
latest version of akka stream. It all worked when I removed that line
in build.sbt.

Then I also realised the graph I wrote made no sense, since I forgot
to wire the docProcFlow in the graph; unfortunately the IDE had the
above issue and masked the compiler error with other errors.

But yeah, all makes sense now. I plan to grow this experiment and see
how it works with REST and AMQP.

Thanks for your kind help! :)

_Simone


On Sat, May 2, 2015 at 11:32 PM, Konrad Malawski
konrad.malaw...@typesafe.com wrote:
 Seems I pasted the wrong gist-link, I meant:
 https://gist.github.com/ktoso/32e8e098616ddd3e9776 (green in intellij for
 me).
 In general if you see errors about being unable to find a matching method
 for ~ types are wrong between the inlet/outlet.

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

 On 2 May 2015 at 22:09:28, Simone Scarduzio (scardu...@gmail.com) wrote:

 Hey nevermind, I made it work!

 https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b#file-workinggraph-scala

 Wohoo! ;)

 IntelliJ still gives me all kinds of errors. I guess it's about corrupted
 cache.
 Once again, my golden rule is confirmed: only trust sbt compile output.

 _S


 On Sat, May 2, 2015 at 8:47 PM, Simone Scarduzio scardu...@gmail.com
 wrote:

 Hi Konrad,

 Unfortunately I have problems to see your changes, when I click your gist
 link I see identical code to mine.

 _S

 On Sat, May 2, 2015 at 7:38 PM, Konrad Malawski
 konrad.malaw...@typesafe.com wrote:

 Seems you forgot to extend RawDocument in Document, which manifested
 itself in being unable to wire up flows of not-compatible types.
 I forked and fixed the minor typos in your code:
 https://gist.github.com/ktoso/8140969c4aead4103317

 Happy hakking, I hope you’ll enjoy Akka Streams as much as we do :-)


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

 On 2 May 2015 at 20:24:40, Simone Scarduzio (scardu...@gmail.com) wrote:

 Hey Konrad,

 Thanks for the fast reply. I made a summary of my problem in this gist.

 https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b

 Also the code from github is not working, it must be some problem with my
 environment :(

 _S

 On Sat, May 2, 2015 at 7:04 PM, Konrad Malawski
 konrad.malaw...@typesafe.com wrote:

 Hi Simone!
 All examples in the docs are compiled and tested before we release them,
 so let ma assure you the code is valid.

 The entire code is listed here if you’d like to have a look at the
 complete file:

 https://github.com/akka/akka/blob/release-2.3-dev/akka-docs-dev/rst/scala/code/docs/stream/TwitterStreamQuickstartDocSpec.scala

 Can you paste the code snippet which you have trouble getting to work?
 Are you sure you are using the `akka.stream.scaladsl.FlowGraph` and not
 the javadsl one? (javadsl understandably does not have Implicits).

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

 On 2 May 2015 at 20:01:07, Simone Scarduzio (scardu...@gmail.com) wrote:

 Hi all,

 I'm a beginner with Akka Stream, but I found a couple of problems trying
 to compile the quick start example provided in the docs.

 FlowGraph does not have a closed() method
 FlowGraph.Implicits does not exist

 I'm using this sbt dependency:

 com.typesafe.akka %% akka-stream-experimental % 1.0-RC2


 Thanks for your help,

 _Simone
 --
  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 http://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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] [java 2.3.x] Cluster response not working

2015-05-02 Thread Chanan Braunstein
Hello,

I have a cluster system and I am trying to do a request-response across 
nodes.However the response is not going to the correct actor (going to dead 
letter). It gets to the destination and gets back to the correct node, but 
on the source node I am getting:

[INFO] [05/02/2015 19:07:40.397] 
[GameClusterSystemQuery-akka.actor.default-dispatcher-15] 
[akka://GameClusterSystemQuery/user/$a/$a] Message 
[com.example.protocols.QueryProtocols$PlayerNameResponse] from 
Actor[akka.tcp://GameClusterSystemQuery@127.0.0.1:2553/user/sharding/PlayerRegionQuery/Test-1#-746072976]
 
to Actor[akka://GameClusterSystemQuery/user/$a/$a#992123708] was not 
delivered. [1] dead letters encountered. This logging can be turned off or 
adjusted with configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.

Logging the sender on the remote note gives me this:

[INFO] [05/02/2015 19:07:40.393] 
[GameClusterSystemQuery-akka.actor.default-dispatcher-23] 
[akka://GameClusterSystemQuery/user/sharding/PlayerRegionQuery/Test-1] 
Sender: 
Actor[akka.tcp://GameClusterSystemQuery@127.0.0.1:52894/user/$a/$a#992123708]

Which matches the output on the source node. Why is the response going to 
dead letter?

Thanks,

Chanan




-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka Stream quick start guide not working

2015-05-02 Thread Konrad Malawski
Seems I pasted the wrong gist-link, I meant: 
https://gist.github.com/ktoso/32e8e098616ddd3e9776 (green in intellij for me).
In general if you see errors about being unable to find a matching method for 
~ types are wrong between the inlet/outlet.

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

On 2 May 2015 at 22:09:28, Simone Scarduzio (scardu...@gmail.com) wrote:

Hey nevermind, I made it work!

https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b#file-workinggraph-scala

Wohoo! ;)

IntelliJ still gives me all kinds of errors. I guess it's about corrupted 
cache. 
Once again, my golden rule is confirmed: only trust sbt compile output.

_S


On Sat, May 2, 2015 at 8:47 PM, Simone Scarduzio scardu...@gmail.com wrote:
Hi Konrad,

Unfortunately I have problems to see your changes, when I click your gist link 
I see identical code to mine. 

_S

On Sat, May 2, 2015 at 7:38 PM, Konrad Malawski konrad.malaw...@typesafe.com 
wrote:
Seems you forgot to extend RawDocument in Document, which manifested itself in 
being unable to wire up flows of not-compatible types.
I forked and fixed the minor typos in your code: 
https://gist.github.com/ktoso/8140969c4aead4103317

Happy hakking, I hope you’ll enjoy Akka Streams as much as we do :-)


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

On 2 May 2015 at 20:24:40, Simone Scarduzio (scardu...@gmail.com) wrote:

Hey Konrad, 

Thanks for the fast reply. I made a summary of my problem in this gist.

https://gist.github.com/sscarduzio/7b65ecc3685bbe335e6b

Also the code from github is not working, it must be some problem with my 
environment :(

_S

On Sat, May 2, 2015 at 7:04 PM, Konrad Malawski konrad.malaw...@typesafe.com 
wrote:
Hi Simone!
All examples in the docs are compiled and tested before we release them, so let 
ma assure you the code is valid.

The entire code is listed here if you’d like to have a look at the complete 
file: 
https://github.com/akka/akka/blob/release-2.3-dev/akka-docs-dev/rst/scala/code/docs/stream/TwitterStreamQuickstartDocSpec.scala

Can you paste the code snippet which you have trouble getting to work?
Are you sure you are using the `akka.stream.scaladsl.FlowGraph` and not the 
javadsl one? (javadsl understandably does not have Implicits).

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

On 2 May 2015 at 20:01:07, Simone Scarduzio (scardu...@gmail.com) wrote:

Hi all,

I'm a beginner with Akka Stream, but I found a couple of problems trying to 
compile the quick start example provided in the docs.
FlowGraph does not have a closed() method
FlowGraph.Implicits does not exist
I'm using this sbt dependency:

com.typesafe.akka %% akka-stream-experimental % 1.0-RC2


Thanks for your help,

_Simone
--
 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 http://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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Testing Supervisor Strategies

2015-05-02 Thread Harit Himanshu
The best I could write is to make sure that the `DiskMonitor` is stopped 
once the exception occurs  

@Test
  public void testSupervisorForFailure() {
new JavaTestKit(system) {{

  final MapString, String configValues =
  Collections.singletonMap(tenant.assetsLocation, 
/non/existentLocation);
  final Config config = mergeConfig(configValues);

  final TestActorRefTenantMonitorActor tenantTestActorRef = 
getTenantMonitorActor(config);
  final ActorRef diskMonitorRef = 
tenantTestActorRef.underlyingActor().getContext()
  .getChild(TenantMonitorActor.DISK_MONITOR);

  final TestProbe testProbeDiskMonitor = new TestProbe(system);
  testProbeDiskMonitor.watch(diskMonitorRef);
  tenantTestActorRef.tell(new TenantMonitorMessage(), getRef());
  testProbeDiskMonitor.expectMsgClass(Terminated.class);
}};
  }

Are there better ways?
Thoughts?

On Saturday, May 2, 2015 at 1:50:49 PM UTC-7, Harit Himanshu wrote:

 I am very new to `Akka` and using `Java` to program my system. 

 **Problem definition**  
 - I have a `TenantMonitor` which when receives `TenantMonitorMessage()`, 
 starts a new actor `DiskMonitorActor`.  
 - The `DiskMonitorActor` may fail for various reasons and may throw 
 `DiskException`. The `DiskMonitorActor` has been Unit Tested.  

 **What I need?**  
 - I want to test behavior `TenantMonitorActor`, so that when 
 `DiskException` happens, it takes correct action like `stop()`, `resume()` 
 or any (depending upon what my application may need)  

 **What I tried?**  
 Based on the [documentation][1], the closest I could perform is the 
 section called **Expecting Log Messages**.   

 **Where I need help?**  
 - While I understand the expecting the correct error log is important, it 
 just asserts first part, that exception is thrown and is logged correctly, 
 but does not help in asserting that right `strategy` is called  


 *TenantMonitorActor*

 public class TenantMonitorActor extends UntypedActor {
 
   public static final String DISK_MONITOR = diskMonitor;
   private static final String assetsLocationKey = 
 tenant.assetsLocation;
   private static final String schedulerKey = 
 monitoring.tenant.disk.schedule.seconds;
   private static final String thresholdPercentKey = 
 monitoring.tenant.disk.threshold.percent;
 
   private final LoggingAdapter logging = 
 Logging.getLogger(getContext().system(), this);
   private final Config config;
 
   private TenantMonitorActor(final Config config) {
 this.config = config;
   }
 
   private static final SupervisorStrategy strategy =
   new OneForOneStrategy(1, Duration.create(1, TimeUnit.SECONDS),
 new FunctionThrowable, Directive() {
 
   public Directive apply(final Throwable 
 param) throws Exception {
 if (param instanceof DiskException) {
   return stop();
 }
 return restart();
   }
 });
 
   public static Props props(final Config config) {
 return Props.create(new CreatorTenantMonitorActor(){
   public TenantMonitorActor create() throws Exception {
 return new TenantMonitorActor(config);
   }
 });
   }
 
   @Override
   public void onReceive(final Object message) throws Exception {
 if (message instanceof TenantMonitorMessage) {
   logging.info(Tenant Monitor Setup);
   setupDiskMonitoring();
 }
   }
 
   @Override
   public SupervisorStrategy supervisorStrategy() {
 return strategy;
   }
 
 
 
   private void setupDiskMonitoring() {
 final ActorRef diskMonitorActorRef = 
 getDiskMonitorActorRef(config);
 
 final FiniteDuration start = Duration.create(0, TimeUnit.SECONDS);
 final FiniteDuration recurring = 
 Duration.create(config.getInt(schedulerKey),
  TimeUnit.SECONDS);
 
 final ActorSystem system = getContext().system();
 system.scheduler()
 .schedule(start, recurring, diskMonitorActorRef,
   new DiskMonitorMessage(), system.dispatcher(), null);
   }
 
   private ActorRef getDiskMonitorActorRef(final Config monitoringConf) 
 {
 final Props diskMonitorProps =
 DiskMonitorActor.props(new 
 File(monitoringConf.getString(assetsLocationKey)),
   
  monitoringConf.getLong(thresholdPercentKey));
 return getContext().actorOf(diskMonitorProps, DISK_MONITOR);
 
   }
 }

 *Test*

   @Test
   public void 

[akka-user] akka.testkit.TestEventListener works only in application.conf and not in another configurations?

2015-05-02 Thread Harit Himanshu
As per docs 
http://doc.akka.io/docs/akka/snapshot/java/testing.html#akka-testkit, 
under (Expecting Log Messages)
ote

Be sure to exchange the default logger with the TestEventListener in your 
application.conf to enable this function:


   1. akka.loggers = [akka.testkit.TestEventListener]


So, this works well when I put it in application.conf.

But since application.con is what gets shipped as application, do we really 
want to keep this logger in application.conf?

In order to separate this, I created another config called 
test.monitoring.conf, which looks like  

include application.conf

akka {
  loggers = [akka.testkit.TestEventListener]
}


But now when I run my test, they fail, even if in my test I can print that 
this Logger is present

SimpleConfigList([akka.testkit.TestEventListener])



What's wrong with my approach?

Thanks
+ Harit Himanshu

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.