Re: [akka-user] Re: Akka Http 10.1.0 Released

2018-03-09 Thread Konrad Malawski
Excellent, thanks for reporting back :)

-- 
Konrad Malawski

On March 10, 2018 at 15:52:46, Gavin Baumanis (gavinbauma...@gmail.com)
wrote:

> Congratulations to all!
> Thanks very much for your ongoing efforts!
>
> I have updated our application to the new version and all my tests pass
> and the application is running as expected.
>
>
> Gavin.
>
> On Friday, 9 March 2018 06:04:19 UTC+11, Johannes Rudolph wrote:
>>
>> Dear hakkers,
>>
>>
>> we are happy to announce Akka Http 10.1.0, the first release of the
>> 10.1.x series.
>>
>>
>> See the announcement at https://akka.io/blog/news/
>> 2018/03/08/akka-http-10.1.0-released.
>>
>>
>> The most important changes are:
>>
>>- The new client pool implementation introduced in 10.0.11 is now the
>>default. We have identified and fixed several bugs in the RC period so by
>>now we are quite confident that the new client pool will be a solid
>>replacement for the legacy one.
>>- Documentation has been completely consolidated between Scala and
>>Java pages. Hundreds of directive documentation pages have been merged in 
>> a
>>tireless effort by @jonas <https://github.com/jonas>, @jlprat
>><https://github.com/jlprat>, and Akka team’s @raboof
>><https://github.com/raboof>. The overall documentation structure has
>>been improved.
>>- Experimental artifacts are available for Scala 2.13.0-M3.
>>- Support for Akka 2.4.x, which is at its end-of-life with the end of
>>2017, has been removed. In the future, this will allow us to make use of
>>features that only Akka 2.5 supports.
>>- Methods deprecated during the life-time of Akka HTTP 10.0.x have
>>been removed. Methods just deprecated for 10.0.11 have not yet been 
>> removed
>>to allow for a smooth transition.
>>
>> New client pool implementation is now the default
>>
>>
>> The new client pool implementation introduced in 10.0.11 is now the
>> default. Since 10.0.11, we fixed several bugs in the new client pool
>> implementation. You can still fall back to the old implementation by
>> setting akka.http.host-connection-pool.pool-implementation = legacy.
>>
>> Akka is not an explicit dependency anymore / Removal of Akka 2.4 support
>>
>> Akka HTTP 10.0.x has always supported Akka 2.5, while allowing users to
>> still remain on Akka 2.4.x if they choose to do so. By now Akka 2.4 has
>> reached its end of life. Therefore, Akka HTTP 10.1.x only supports Akka >=
>> 2.5.11 (and future versions during the life of Akka HTTP 10.1.x) so we will
>> be able to make of features only provided by Akka 2.5. In some cases we
>> bump the minimum supported patch version of Akka to be able to use new
>> features quickly.
>>
>>
>> Using Akka HTTP with Akka 2.5 used to be a bit confusing, because Akka
>> HTTP explicitly depended on Akka 2.4. Trying to use it together with Akka
>> 2.5, running an Akka HTTP application could fail with class loading issues
>> if you forgot to add a dependency to both akka-actor and akka-stream of
>> the same version. For that reason, we changed the policy not to depend on
>> akka-stream explicitly anymore but mark it as a provided dependency in
>> our build. That means that you will always have to add a manual
>> dependency to akka-stream (veterans may remember this policy from Spray).
>>
>>
>> Please make sure you have chosen and added a dependency to akka-stream when
>> updating to the new version.
>>
>>
>> Currently, the right dependency to add is
>>
>>
>> libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.5.11"
>>
>>
>> Support for Scala 2.13.0-M3
>>
>>
>> Akka HTTP 10.1.0 is released for Scala 2.11, 2.12, and 2.13.0-M3. Due to
>> a regression in Scala 2.13.0-M3
>> <https://github.com/scala/scala-dev/issues/467> tail call optimization
>> does not apply anymore in some cases where it did before which might lead
>> to stack overflow when running with Scala 2.13.0-M3.
>>
>> Deprecation Removals
>>
>> Methods were removed that have been deprecated during the life-time of
>> Akka HTTP 10.0.x. Methods that were only deprecated in the last release of
>> Akka HTTP, 10.0.11, are not yet removed to allow for a smooth transition.
>> In general, our guarantee for minor release updates is that code that
>> compiled on the latest version of the previous minor release (10.0.11 in
>> this case) should be both source and bi

Re: [akka-user] Akka Actor usage in Apache Spark and Apache Flink

2018-02-19 Thread Konrad Malawski
Another pretty big Akka based project (as in, really using Akka a lot) is
Apache OpenWhisk, the open source "amazon lambda";
Check it out as well.

https://github.com/apache?q=openwhisk

On Mon, Feb 19, 2018 at 2:32 PM, Konrad “ktoso” Malawski <
konrad.malaw...@lightbend.com> wrote:

> Best to ask on a Flink forum ;-)
>
> --
> Cheers,
> Konrad 'ktoso <http://kto.so>' Malawski
> Akka <http://akka.io/> @ Lightbend <http://lightbend.com/>
>
> On February 19, 2018 at 14:32:15, Unmesh Joshi (unmeshjo...@gmail.com)
> wrote:
>
> Thanks Konrad.
> What I was interested in was what use cases both Spark and Flink used
> Actors for specifically. Are there any notes/docs around those that anyone
> knows of?
>
>
>
> On Monday, 19 February 2018 07:33:43 UTC+5:30, Konrad Malawski wrote:
>>
>> Hi there,
>> There's been some confusion about how Spark used Akka, so let's clear
>> that up first:
>> It wasn't really core to any of the operations or core of Spark, and was
>> used only to orchestrate some things,
>> it was using raw Akka Remoting (which is discouraged, use Cluster instead
>> due to the resilience benefits it gives).
>>
>> Users would sometimes want to combine Akka based things with their Spark
>> jobs, but since Spark did not have Akka as a focus-on
>> thing, but merely a small piece of code they tagged along, and they had
>> internal mechanisms to do similar things as they used Akka for (just a few
>> simple rpc-style calls),
>> it was better for everyone to remove the dependency -- as Spark was using
>> a rather old version, and people wanted to use recent versions of Akka --
>> the usual dependency mess you get with big projects in other words.
>>
>> Thus Akka was removed from Spark, allowing users to bring their own Akka
>> based libraries into Spark apps at-will, which is better for both projects
>> and users as well.
>> Shedding dependencies is generally a good thing, and I think Spark did
>> the right thing there. You'll also notice how Akka tries to avoid any kind
>> of external dependency that we're able to avoid -- for the same reasons,
>> avoiding dependency hell for end users.
>>
>> Hope this helps,
>>
>> On Sun, Feb 18, 2018 at 8:58 PM, Unmesh Joshi <unmes...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Apache Spark used to use Akka Actors (which is replaced by Netty now)
>>> and Apache Flink uses Actors. I am trying to understand the use case of
>>> Actor usage in both these frameworks. Any pointers for help?
>>>
>>> Thanks,
>>> Unmesh
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>> p/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.
>>>
>>
>>
>>
>> --
>> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>


-- 
Cheers,
Konrad 'ktoso' Malawski
Akka <http://akka.io/> @ Lightbend <http://lightbend.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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka Actor usage in Apache Spark and Apache Flink

2018-02-18 Thread Konrad Malawski
Hi there,
There's been some confusion about how Spark used Akka, so let's clear that
up first:
It wasn't really core to any of the operations or core of Spark, and was
used only to orchestrate some things,
it was using raw Akka Remoting (which is discouraged, use Cluster instead
due to the resilience benefits it gives).

Users would sometimes want to combine Akka based things with their Spark
jobs, but since Spark did not have Akka as a focus-on
thing, but merely a small piece of code they tagged along, and they had
internal mechanisms to do similar things as they used Akka for (just a few
simple rpc-style calls),
it was better for everyone to remove the dependency -- as Spark was using a
rather old version, and people wanted to use recent versions of Akka -- the
usual dependency mess you get with big projects in other words.

Thus Akka was removed from Spark, allowing users to bring their own Akka
based libraries into Spark apps at-will, which is better for both projects
and users as well.
Shedding dependencies is generally a good thing, and I think Spark did the
right thing there. You'll also notice how Akka tries to avoid any kind of
external dependency that we're able to avoid -- for the same reasons,
avoiding dependency hell for end users.

Hope this helps,

On Sun, Feb 18, 2018 at 8:58 PM, Unmesh Joshi  wrote:

> Hi,
>
> Apache Spark used to use Akka Actors (which is replaced by Netty now) and
> Apache Flink uses Actors. I am trying to understand the use case of Actor
> usage in both these frameworks. Any pointers for help?
>
> Thanks,
> Unmesh
>
> --
> >> 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,
Konrad 'ktoso' Malawski
Akka  @ Typesafe 

-- 
>>  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] Cancel Actor job

2018-01-25 Thread Konrad Malawski
Actors are cheap so you can start one actor (make them child actors if some
actor that manages the work things), so then you don’t have that
multiplexing issue at all.

Remember to put the blocking things onto a dedicated thread pool dispatcher
— read docs about dealing with blocking to see how

-- 
Konrad Malawski

On January 26, 2018 at 3:56:05, Richard Gong (gong...@gmail.com) wrote:

> I'm newbie in Akka. Here's one thing I'm trying to achieve, a simple job
> manager. There are jobs involving SQL queries and CPU intended computation.
> The jobs should be cancellable while they're running. Here's my code to
> simulate it. The worker actor sends "continue" message to itself if no
> cancellation signal. However, the master actor may sends another job to it
> while the current job is still running. Question is how to guarantee the
> jobs don't step on each other? This may not be the way Actors do. Any
> suggestions are very welcome.
>
> import java.io.IOException;
>
> import akka.actor.AbstractActor;
> import akka.actor.ActorRef;
> import akka.actor.ActorSystem;
> import akka.actor.Props;
> import akka.routing.RoundRobinPool;
>
> class StartJob {
> private final String id;
> private final int time;
>
> public StartJob(String id, int time) {
> super();
> this.id = id;
> this.time = time;
> }
>
> public String getId() {
> return id;
> }
>
> public int getTime() {
> return time;
> }
>
> }
>
> class CancelJob {
> private final String id;
>
> public CancelJob(String id) {
> super();
> this.id = id;
> }
>
> public String getId() {
> return id;
> }
>
> }
>
> class Worker extends AbstractActor {
>
> private String jobId;
> private boolean cancelling;
> private int time;
> private int i;
>
> @Override
> public Receive createReceive() {
> return receiveBuilder().match(StartJob.class, job -> {
> jobId = job.getId();
> cancelling = false;
> i = 0;
> time = job.getTime();
> System.out.printf("Worker %s starts with id=%s\n", self(),
> job.getId());
> self().tell("continue", self());
> }).matchEquals("continue", p -> {
> if (cancelling) {
> System.out.printf("Worker %s cancelled.\n", jobId);
> return;
> }
> System.out.printf("Worker %s progress %.0f%%\n", jobId, i *
> 100.0 / time);
> Thread.sleep(1000); // simulate SQL query
> for (int j=0; j<100; j++); // simulate CPU intended job
> i++;
> if (i < time) {
> self().tell("continue", self());
> } else {
> System.out.printf("Worker %s finished.\n", self());
> }
> }).match(CancelJob.class, job -> job.getId().equals(jobId), job ->
> {
> System.out.printf("Worker %s cancelling.\n", job.getId());
> cancelling = true;
> }).build();
> }
>
> }
>
> class Master extends AbstractActor {
>
> private final ActorRef workerRouter;
>
> public Master(int numWorkers) {
> workerRouter =
> this.getContext().actorOf(Props.create(Worker.class).withRouter(new
> RoundRobinPool(numWorkers)),
> "workerRouter");
> }
>
> @Override
> public Receive createReceive() {
> return receiveBuilder().match(StartJob.class, job -> {
> System.out.printf("Submitting job %s\n", job.getId());
> workerRouter.tell(job, self());
> }).match(CancelJob.class, job -> {
> System.out.printf("Cancelling job %s\n", job.getId());
> getContext().actorSelection("workerRouter/*").tell(job,
> self());
> }).build();
> }
> }
>
> public class AnalyticsApp {
> public static void main(String[] args) throws IOException,
> InterruptedException {
> ActorSystem system = ActorSystem.create("JobManager");
>
> ActorRef masterRef = system.actorOf(Props.create(Master.class, 2),
> "job-manager");
> System.out.println("Master: " + masterRef);
>
> for (int i = 0; i < 4; i++) {
> masterRef.tell(new StartJob(Integer.toString(i), 5),
> ActorRef.noSender());
> }
>
> Thread.sleep(1000);
> masterRef.tell(new CancelJob("1"), ActorRef.noS

Re: [akka-user] Update Aeron to 1.7?

2017-12-30 Thread Konrad Malawski
It already is updated in the sources since some weeks:
https://github.com/akka/akka/blob/master/project/Dependencies.scala

Await an upcoming release with it.
Happy new year!

-- 
Konrad Malawski

On December 31, 2017 at 0:12:05, Vishnu Vardhan (vardh...@gmail.com) wrote:

> Hi Guys
>
> I think i am being hit by https://github.com/real-logic/aeron/issues/329,
> fixed in 1.7
>
> I see that akka still uses Aeron 1.3 released in May, and i am wondering
> if this will be updated soon
>
> Best Regards
> Vishnu
> --
> >>>>>>>>>> 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] Turn a flow to a route

2017-12-15 Thread Konrad Malawski
(My bad about reading your statement, you wrote it right — it is true
though that the inverse conversion simply is not possible in general)

-- 
Konrad Malawski

On December 15, 2017 at 12:51:34, haghard (haghar...@gmail.com) wrote:

> Hello everybody,
>  akka-http has a way to turn a route into a flow but I cannot find how to
> go in another direction (from a flow to a route)
>
> 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.
>

-- 
>>>>>>>>>>  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] Turn a flow to a route

2017-12-15 Thread Konrad Malawski
I think you’re misunderstanding something.
Akka HTTP can convert a route to a Flow (the inverse of what you said), and
an opposite transformation is not in general possible.

What specifically are you trying to achieve?

-- 
Konrad Malawski

On December 15, 2017 at 12:51:34, haghard (haghar...@gmail.com) wrote:

> Hello everybody,
>  akka-http has a way to turn a route into a flow but I cannot find how to
> go in another direction (from a flow to a route)
>
> 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.
>

-- 
>>>>>>>>>>  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] Is it easy to use akka-http to build ...?

2017-12-08 Thread Konrad Malawski
Please search the docs for “websocket” it’s well documented. Short reply
since in meetings now ;-)

Glad you enjoyed the VJUG talk!

-- 
Konrad Malawski

On December 8, 2017 at 12:58:21, Thai (lgoptimusv...@gmail.com) wrote:

> And how about the websocket?
>
> On Thursday, December 7, 2017 at 10:17:03 PM UTC-5, Konrad Malawski wrote:
>>
>> It’s pretty much as simple as using this directive:
>> https://doc.akka.io/docs/akka-http/current/scala/http/
>> routing-dsl/directives/file-and-resource-directives/getFromDirectory.html
>>
>> https://doc.akka.io/docs/akka-http/current/scala/http/
>> routing-dsl/directives/file-and-resource-directives/getFromResource.html
>> or it’s similar versions (explore the docs).
>>
>> For basics of building an app read:
>> http://developer.lightbend.com/guides/akka-http-quickstart-scala/
>>
>> happy hakking!
>>
>> --
>> Cheers,
>> Konrad 'ktoso <http://kto.so>' Malawski
>> Akka <http://akka.io/> @ Lightbend <http://lightbend.com/>
>>
>> On December 8, 2017 at 12:15:30, Thai (lgopti...@gmail.com )
>> wrote:
>>
>> Hi All,
>>
>> Is it easy to use akka-http to build a web app that can serve static
>> files (only 1 html file but it has many 

Re: [akka-user] Akka persistence plugin TCK test on java via maven - how to trigger the test suite ?

2017-11-22 Thread Konrad Malawski
This is resolved by
https://github.com/ktoso/akka-persistence-tck-testing-from-java/pull/2
Have a look there.

Happy hakking

On Thu, Nov 23, 2017 at 7:46 AM, mahmoud romeh 
wrote:

> Hi All ,
>
> I have referenced the documentation for how to test new akka persistence
> plugin via TCK test maven dependency , i have created Java journal specs as
> being described there but when i do mvn test i do not see the test cases
> are triggered of the akka TCK , do u know i need a specific maven test
> plugin to fire the predefined test suites in that TCK maven akka dependency
> ?
>
> Any guidelines will be helpful as i am customizing a one for apache ignite
> with akka persistence .
>
> Thanks a lot
>
> --
> >> 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,
Konrad 'ktoso' Malawski
Akka  @ Typesafe 

-- 
>>  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 JDK 9 module support

2017-11-05 Thread Konrad Malawski
We’ll likely be able o add the automatic module name in the next release as
it’s relatively low effort and other tooling is not blocking us from doing
so.

Please watch this ticket
https://github.com/akka/akka/issues/23789#issuecomment-340668877

Curious what reason for you is the main one to start  adopting modules into
your build btw.

-- 
Konrad Malawski

On November 6, 2017 at 6:42:44, Grzegorz Olechwierowicz (
thertan...@gmail.com) wrote:

> Hello,
>
> I'm trying to add akka to java 9 project.
> What do I have to require in module-info.java to use Akka with JDK 9? I
> have following dependency in maven and cannot figure it out.
>
> 
>   com.typesafe.akka
>   akka-actor_2.12
>   2.5.6
> 
>
>
> Here are my thoughts...
> Akka actor jar name is weird, the name of the module is derived from the
> name of the jar itself since it does not contain explicit module
> declaration.
> One solution can be to add Automatic-Module-Name to the main manifest.
> The question is whether or when is this going to be supported?
> --
> >>>>>>>>>> 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] Akka FSM, Persistence and multiple instances

2017-10-28 Thread Konrad Malawski
But if you can have concurrent writes, because requests to multiple nodes
and timing etc, you do run st the risk. Also, stopping actors a meter every
write is very weird and not what akka persistence was really designed for.
It’s not a key value store, it’s event sourcing for medium-long loved
entities.

-- 
Konrad Malawski

On October 28, 2017 at 17:44:08, wapgui (torsten.schm...@wapgui.com) wrote:

> I'm closing the actors after each request and recreate with the same uuid.
>
> Am Samstag, 28. Oktober 2017 10:41:28 UTC+2 schrieb Konrad Malawski:
>>
>> Are you creating many persistent actors with the same persistence I’d?
>> That of course breaks things. Please read the persistence docs and use akka
>> cluster with cluster sharding instead to handle the cluster creating the
>> actors. This not only is easier but also is safe - the uniqueness will be
>> guaranteed by sharding then.
>>
>> --
>> Konrad Malawski
>>
>> On October 28, 2017 at 17:34:12, wapgui (torsten...@wapgui.com
>> ) wrote:
>>
>>> Hi,
>>>
>>> I've built a FSM using Akka FSM and Persistence to a Percona cluster in
>>> near cloud.
>>> Running this environment in a single instance causes no problems at all.
>>> If I dockerize this single instance and running it at 2 instances causes
>>> sometimes problems with the state.
>>> E.g. making the first request with New creates the state object on an
>>> instance. From the second instance the next request calls to switch to the
>>> next state, but the FSM answers there is no object and a switch is not
>>> possible. The second request was 14s after the first one.
>>> My service creates an actor each time a request comes in with the
>>> reference to the uuid of the process. After handling the request, the actor
>>> will be closed, until the next request comes in. Is this really necessary?
>>> I made this because of the multiple instances to be sure the state of the
>>> actor is the same on all instances. Maybe I've there a missunderstanding
>>> and I can leave the FSM actors on system, generating clones on other
>>> instances and the persistence handles the data exchange on all these
>>> instances.
>>>
>>> Could somebody explain me what is the right decision?
>>>
>>> Best regards
>>> Torsten
>>>
>>> --
>>> >>>>>>>>>> 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.
>

-- 
>>>>>>>>>>  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 FSM, Persistence and multiple instances

2017-10-28 Thread Konrad Malawski
Are you creating many persistent actors with the same persistence I’d? That
of course breaks things. Please read the persistence docs and use akka
cluster with cluster sharding instead to handle the cluster creating the
actors. This not only is easier but also is safe - the uniqueness will be
guaranteed by sharding then.

-- 
Konrad Malawski

On October 28, 2017 at 17:34:12, wapgui (torsten.schm...@wapgui.com) wrote:

> Hi,
>
> I've built a FSM using Akka FSM and Persistence to a Percona cluster in
> near cloud.
> Running this environment in a single instance causes no problems at all.
> If I dockerize this single instance and running it at 2 instances causes
> sometimes problems with the state.
> E.g. making the first request with New creates the state object on an
> instance. From the second instance the next request calls to switch to the
> next state, but the FSM answers there is no object and a switch is not
> possible. The second request was 14s after the first one.
> My service creates an actor each time a request comes in with the
> reference to the uuid of the process. After handling the request, the actor
> will be closed, until the next request comes in. Is this really necessary?
> I made this because of the multiple instances to be sure the state of the
> actor is the same on all instances. Maybe I've there a missunderstanding
> and I can leave the FSM actors on system, generating clones on other
> instances and the persistence handles the data exchange on all these
> instances.
>
> Could somebody explain me what is the right decision?
>
> Best regards
> Torsten
>
> --
> >>>>>>>>>> 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: Spray->Akka-Http Migration - seeing high 99th percentile latencies post-migration

2017-10-12 Thread Konrad Malawski
When asking about performance and benchmarks always include specific
numbers, code, and benchmark methodology otherwise it’s just guessing and
inventing numbers and reasons.

Thanks

-- 
Konrad Malawski

On October 13, 2017 at 5:36:06, Gary Malouf (malouf.g...@gmail.com) wrote:

> To be clear, 95th percentile and down are as low as before so wondering if
> this is a new connection closing penalty being paid or if the actor system
> needs to be tuned differently now...
>
> On Thursday, October 12, 2017 at 4:31:14 PM UTC-4, Gary Malouf wrote:
>>
>> We have a web service that we just finished migrating from spray 1.3 to
>> Akka-Http 10.0.9.  While in most cases it is performing well, we are seeing
>> terrible 99th percentile latencies 300-450ms range) starting from a very
>> low request rate (10/second) on an ec2 m3.large.
>>
>> Our service does not do anything complicated - it does a few Map lookups
>> and returns a response to a request.  In spray, even 99th percentile
>> latencies were on the order of 1-3 ms, so we are definitely concerned.
>> Connections as with many pixel-type servers are short-lived -> we actually
>> pass the Connection: Close header intentionally in our responses.
>>
>> Is there any obvious tuning that should be done on the server
>> configuration that others have found?
>>
> --
> >>>>>>>>>> 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] [akka-streams] Shared Materializer in akka extensions

2017-09-29 Thread Konrad Malawski
Though I'm not sure it actually is as important to have the users and your
extension share a materializer by the way.
What is it you're building exactly?

Keeping one materializer in the extension could be totally fine as well.

On Sat, Sep 30, 2017 at 11:18 AM, Konrad “ktoso” Malawski <
konrad.malaw...@lightbend.com> wrote:

> When they use it;
>
> def use(...)(implicit m: Materializer)
>
> —
> Konrad `kto.so` Malawski
> Akka  @ Lightbend 
>
> On 30 September 2017 at 11:18:16, Jeff (jknight12...@gmail.com) wrote:
>
> How, exactly. You only have access to an ExtendedActorSystem inside of
> createExtension()
>
> --
> >> 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,
Konrad 'ktoso' Malawski
Akka  @ Lightbend 

-- 
>>  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 memory leak suspect

2017-09-25 Thread Konrad Malawski
This code seems unlikely to be the cause, likely somewhere else - run your
app while profiling to find the leak.

On Mon, Sep 25, 2017 at 7:26 PM, Bartosz Jankiewicz <
bartosz.jankiew...@gmail.com> wrote:

> Indeed, this is what it looks like :)
>
> The only place where I use actors is in Akka Http routes. The service I'm
> using returns a future. The only clue I had was that the Future results
> returned from my service never evaluate could cause the stream workers to
> stack. But in such case I should also spot large number of Future objects
> on the heap but I don't observe that.
>
> def campaign(): Route =
> path("campaign") {
>   get {
> withRequestTimeout(1 second) {
>   parameters('cookieId, 'ip, 'debug.?) { (cookieId, ip, debug) =>
> val verbose = debug match {
>   case Some("missingCampaigns") => true
>   case _ => false
> }
> val resultF: Future[EvaluationResult] =
> Free.liftF(EvaluateCampaign(cookieId, ip, verbose))
>   .foldMap(evaluationService)
> onSuccess(resultF) { result =>
>   complete(result)
>     }
>   }
> }
>   }
> }
>
>
>
>
> On Monday, 25 September 2017 11:01:08 UTC+2, Konrad Malawski wrote:
>>
>> What are you doing in the app ;-)
>> Sounds to me like you’re starting tons of things that are never stopped.
>>
>> —
>> Konrad `kto.so` Malawski
>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>
>> On 25 September 2017 at 17:38:57, Bartosz Jankiewicz (
>> bartosz.j...@gmail.com) wrote:
>>
>> I have been running an app with Akka Http 1.0.9.
>>
>> It had only single endpoint respoding with JSON. The service returned the
>> value as future therefore I used onComlete semantics.
>>
>> The app was consistently running into OoM issues. Heap dump analysis has
>> led me to 1,536,693 instances of akka.actor.ActorCell. Along with
>> accompanying objects (scala.collection.immutable.RedBlackTree$BlackTree)
>>  it saturated the heap. All ActorCell objects seem to be related to
>> Akka-Streams - their names are: StreamSupervisor-xx
>>
>> Has anyone fallen into a similar issue?
>> --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>> urrent/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.
>



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


Re: [akka-user] Speeding up actor system boot time in testing environment

2017-08-27 Thread Konrad Malawski
Why do you need to start new systems?

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 27 August 2017 at 16:59:02, Jakub Liska (liska.ja...@gmail.com) wrote:

Hey,

actor system boot time matters in distributed systems integration testing,
otherwise spinning system 100 times in a test suite could
take minutes. I currently cannot use multi JVM testing, so I'm wondering
whether there is a way how to improve system boot time.

Currently forking a JVM with an actor system takes no less than 800ms from
my experience.
--
>> 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] akka-streams: what causes the downstream to be "cancelled"/onDownstreamFinish called?

2017-06-26 Thread Konrad Malawski
yes, a failure in the stream could lead to cancellation of the upstream
stages of where the error was induced. it basically is the way a stream is
being shut down on a failure.

On Jun 26, 2017 21:04, "Josh F" <jof...@gmail.com> wrote:

> Hi Konrad,
>
> Thanks for the reply!
>
> I can't really share the full snippet as it has a load of company-specific
> code in there, but good to know that the code I pasted would never cancel.
> I will try to figure out if something else is causing the application to
> stop.
>
> Just wondering, if I didn't have the recoverWith and my handler could
> return a failed future, could that cause the downstream to cancel?
>
> Also not sure if it makes a difference, but I do have a throttler before
> the mapAsync call:
> .throttle(elements = 1, per = 2, maximumBurst = 1, ThrottleMode.shaping)
>
> Thanks,
> Josh
>
>
>
> On Monday, June 26, 2017 at 7:25:38 PM UTC+1, Konrad Malawski wrote:
>>
>> Could you share the full snippet?
>> The code as pasted above would not cancel (downstream cancels, but a
>> Sink.ignore never would cancel).
>> Are you sure you’re not terminating the app or something else that would
>> cause the stream to stop?
>> — Konrad
>>
>>
>> On June 27, 2017 at 3:23:04 AM, Josh F (jof...@gmail.com) wrote:
>>
>> Hi all,
>>
>> I am new to akka-streams - I've just set up a basic pipeline which
>> consumes from a messaging queue and then does some processing on the stream.
>> But after running for a while, the application ceases to process
>> messages, apparently because the downstream has been "cancelled" and
>> onDownstreamFinish has been called on the source.
>>
>> I just want to know what the reason for this might be? What would cause
>> the downstream to be cancelled?
>>
>> For context, my pipeline is very simple - it looks like this:
>>
>> def source: Source[MyMessage, NotUsed] = 
>> def messageHandler(message: MyMessage): Future[Unit] = {
>>   val result =  // Some code here which processes the message and
>> returns a Future[Unit]
>>   result.recoverWith {
>> case _ => Future.successful()
>>   }
>> }
>> def pipeline = source.mapAsync(10)(messageHandler)
>> pipeline.runWith(Sink.ignore)
>>
>> Note that the use of recoverWith means that the message handler will
>> always return a future which completes successfully - even if an exception
>> is thrown somewhere.
>>
>> Is anyone able to offer some advice / insight into what might be
>> happening?
>>
>> Thanks,
>> Josh
>>
>>
>>
>> --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>> urrent/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.
>

-- 
>>>>>>>>>>  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] Order of log lines is mixed when 3rd party logs write directly to SLF4J

2017-06-19 Thread Konrad Malawski
You can always just us slf4j directly - use an async appender in the impl
(logback2 AFAIR provides one and others as well) and you're good.

There's no requirement to use ActorLogging, we only have it to not depend
on a specific logging API in akka-actor itself.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 19 June 2017 at 15:28:35, Natanel Savion (natanel.sav...@gmail.com)
wrote:

Hi,
While using in akka's infrastructure (akka.event.Logging), log lines are
written asynchronously.
If 3rd party code that writes directly to SLF4J runs within the context of
an actor, this can lead to condition where akka code performed before the
3rd party code only gets logged after the 3rd party log due to the time it
takes the logs to be written async.

%X{akkaTimestamp} (see
*http://doc.akka.io/docs/akka/current/java/logging.html#more-accurate-timestamps-for-log-output-in-mdc
*)
can be used to reorder the log but sometimes the timestamp resolution is
not sufficient to reliably order the lines.

Was wondering if someone else may have encountered this problem and
came-up with some solution.
Currently, we are considering writing all our logs directly to SLF4J to
avoid this issue (the SLF4J back-end can be configured with an async
appender to provide similar functionality).

Thanks,
Nati




--
>> 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] No matching constructor found

2017-06-08 Thread Konrad Malawski
Arun, please do not post the same question to 3 different channels when you
already were given a response.
If you need to re send a question, please at least link back to where you
asked already.

This was answered in:
https://stackoverflow.com/questions/44366796/no-matching-constructor-found-on-class-actors-fileobserveractor-for-arguments

You're also doing a few antipatterns in this code that will lead to out of
memory issues - do not just randomly start actor systems for every message.
I explained in depth in the thread where you originaly asked.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 8 June 2017 at 15:50:35, Arun kannan (arun...@gmail.com) wrote:


class FileUploaderActor extends Actor{
  override def receive: Receive = {

case UploadFile(billerId, filename, subCategory, count, dueDate) =>

  val fileOberverActor = ActorSystem().actorOf(Props[FileObserverActor])
  val billerData =
BillerFileUploadMetaData(billerId,filename,count,"ACTIVE",
new java.sql.Timestamp(new
java.util.Date().getTime),subCategory,dueDate)
  val sparkSession = SparkContextHelper.sparkSession;
  import sparkSession.implicits._
  val rdd = sparkSession.sparkContext.parallelize(Seq(billerData))
  val df = rdd.toDF()
  df.write.format("org.apache.spark.sql.cassandra").options(Map("keyspace"
-> "billerplatform_schema", "table" ->
"biller_file_uploads")).mode(SaveMode.Append).save
  fileOberverActor ! FileUploaded(filename, count)
  }}

--
>> 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] Access to the underlying java.util.concurrent.ExecutorService from an Akka Dispatcher

2017-05-29 Thread Konrad Malawski
Lightbend monitoring just-works™ and does this for you if you're interested:
http://developer.lightbend.com/docs/monitoring/latest/instrumentations/akka/dispatchers.html


You can get the information, it's not hidden per-se, however I'm not sure
how well open source alternatives extract the information.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 29 May 2017 at 16:43:06, Alexandre Tamborrino (
tamborrino.alexan...@gmail.com) wrote:

Hello!

Is it possible to access the underlying
java.util.concurrent.ExecutorService from an Akka Dispatcher?

In my case, I'd like to monitor the size of the queue of a
ThreadPoolExecutor (created via an Akka Dispatcher).

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.

-- 
>>  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 - Source of http response.

2017-05-26 Thread Konrad Malawski
Hi Alejandro,
I don't get the question - could you rephrase it a bit (more details)?

An HttpRequest simply contains a Source[ByteString, _] and that "just
works"™.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 26 May 2017 at 00:21:38, Alejandro Merchan (alejandromercha...@gmail.com)
wrote:

Hi everybody.

One question, how is possible create a continuous Source from http client
response?

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.

-- 
>>  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] ANNOUNCE: New documentation theme and Akka HTTP 10.0.7 Released

2017-05-25 Thread Konrad Malawski
Dear hakkers,

We are proud to announce Akka Http 10.0.7, which is the seventh release of
the Akka Http 10.0 series. This is a regular maintenance release that
contains several maintenance fixes, improvements and features that are a
result of our ongoing collaboration with the Play team towards making Akka
HTTP the default backend in Play’s upcoming major release.
Notable changes

A total 29 issues were closed since 10.0.6. Out of those, the most notable
ones are listed below.

You can view the complete list of closed issues can be found on the 10.0.7
 milestone on
github.

*New documentation theme (aligned with new theme in Akka)*

Today, as follow up to yesterday’s Akka 2.5.2 release
, Akka HTTP also
moves to using the new documentation theme. This is the first step towards
even more simplification and restructuring of the documentation such that
everything is simple to find, and also being able to add more practical
examples in the future.

We are aware that the search functionality is currently non-operational,
and are working towards resolving it. The indexing mechanism of the 3rd
party search engine is not yet able to work with our new structure - please
be patient for a little while while we resolve this issue.

*New Seed Templates for Akka HTTP Apps*

We prepared new seed templates for starting out with Akka HTTP using the Java
DSL  as well as Scala DSL
. By using the sbt new
command one can now easily get a small sample project to easily get started
with your first Akka HTTP app. More instructions on the seed template pages.

*New Path Directive **ignoreTrailingSlash***

Akka HTTP treats differently by default a route that ends with slash (/)
than one that doesn’t. From this version on, users who don’t want to have
this distinction, can use a new Path Directive called ignoreTrailingSlash.
This route, will retry its inner route with and without a trailing slash.
If you want to know more about this feature, please check the documentation
pages for Scala and Java API.
List of Changes

Improvements

akka-http

   - Added new Path Directive ignoreTrailingSlash (#880
   )
   - Prepared new seed templates for Akka HTTP apps (for both Java DSL
    and Scala DSL
   ) (#1137
   & #1055
   )
   - Migrated to the new docs theme (same as Akka) (#1129
   )
   - (ApiMayChange) HttpApp#route method was renamed to routes to highlight
   it is “all the routes” (#953
   )

akka-http2-support

   - Synthetic Remote-Address header setting is now honored in HTTP2 server
   blueprint (#1088 )

Bug Fixes

General

   - OSGi Import-Package ranges have been fixed to allow Akka 2.5.x #1097
   

akka-http-core

   - Dates in RFC1123 format with single-digit-day are now properly parsed
   #1110 

Compatibility notes

This version is compatible with Akka 2.4.x as well as the current 2.5.1, so
we encourage you to use Akka 2.5 with this version, as the new completely
redesigned materializer in Akka Streams can result in various performance
and memory usage improvements across the board.

If you want to use Akka HTTP together with Akka 2.5.1 make sure to include
a dependency to akka-stream 2.5.1 and not only to akka-actor 2.5.1
(otherwise, your app may fail at runtime because of incompatibilities
between a 2.4.x version of akka-stream and a 2.5.x version of akka-actor).

Akka 10.0.x is backwards binary compatible with previous 10.0.x releases
and Akka 2.4.x. This means that the new JARs are a drop-in replacement for
the old one (but not the other way around) as long as your build does not
enable the inliner (Scala-only restriction). It should be noted that Scala
2.12.x is is not binary compatible with Scala 2.11.x.
Credits

For this release we had the help of 12 contributors – thank you all very
much!

commits  added  removed
 17212  581 Jonas Fonseca
 12 70  104 Johannes Rudolph
  7230   44 Konrad `ktoso` Malawski
  3381   42 Josep Prat
  1 626 Erwan Loisant
  1  0   28 Richard Imaoka
  1 251 surendranath chowdary
  1 250 bobba surendranath chowdary
  1  9   11 Björn Antonsson
  1  76 michael-smith
  1  22 André Rüdiger
  1  21 Arnout Engelen


Happy hakking!

– The Akka Team

-- 
>>

Re: [akka-user] ANNOUNCE: New Akka documentation, website and Akka 2.5.2 released

2017-05-25 Thread Konrad Malawski
Hi Lee,
RSS works for me, do you use this feed: http://akka.io/rss.xml ?

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 25 May 2017 at 10:06:00, Lee_T (lee.tibb...@gmail.com) wrote:


New blog website looks spiffy.  RSS feed appears broken.
Is it intended to work?  It would be a pity to lose it because
of the transition.

Thanks,

Lee

--
>> 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] ANNOUNCE: New Akka documentation, website and Akka 2.5.2 released

2017-05-24 Thread Konrad Malawski
We believe it may still be indexing the new pages;
If that's not the case we'll investigate deeper shortly :-)

Thanks for reporting

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 24 May 2017 at 20:04:18, Richard Rodseth (rrods...@gmail.com) wrote:

Looks nice.

However, if I go to

http://akka.io/docs/

and type "Dispatcher" in the search box, nothing happens. There's no Search
button, and Enter does nothing either.
Chrome, OS X.
Am I missing something?




On Wed, May 24, 2017 at 7:56 AM, Arnout Engelen <
arnout.enge...@lightbend.com> wrote:

> Dear hakkers,
>
> We are excited to announce not only a new patch release of Akka 2.5 but
> also brand new akka.io website and documentation.
>
> New
> documentation
>
> One conclusion from the community survey 2016
>  was
> that the getting started experience of Akka must be improved. Therefore we
> have written completely new Getting Started
>  and
> Quickstart  guides.
>
> A special thanks to Endre Varga  who wrote
> most of the Getting Started guide.
>
> You find the landing page for the documentation at http://akka.io/docs/
>
> The documentation tooling has been changed to Paradox
> . The markdown syntax and the zero
> installation will make it easier for contributors to help out with
> improving the documentation. Such contributions are very welcome and you
> find instructions in CONTRIBUTING.md
> .
>
> Akka
> 2.5.2
>
> If you are using Cluster Sharding with "remembering entities" there is one
> important change that requires that you make a change to your code when
> updating to 2.5.2. To solve a critical issue #22289
>  that could result in
> duplicate entities when the extractShardId function is changed (e.g.
> between deployments) there is now a new message Shard.StartEntity(
> entityId)that the extractShardId must understand. See example in Scala
> 
>  or Java
> 
> .
>
> Some other notable improvements and bug fixes of Akka 2.5.2 are:
>
>- Sharding entities not restarted after full cluster restart in ddata
>mode, #22868 
>- Bug in sharding snapshot deletion, #22916
>
>- Report cause for Akka IO TCP CommandFailed, #22954
>
>- BackoffSupervisor can reply to messages when child is stopped, #21213
>
>
> The development branch of Akka Typed has been merged back to master and is
> included in Akka 2.5.2, see the blog post series starting with Akka
> Typed: Hello World in the new API
> . The APIs may still
> change but we are confident that most of it is now stable. We will continue
> the work by integrating with other parts of Akka, such as Streams,
> Persistence, and Cluster.
>
> A total of 77 issues were closed since 2.5.1. The complete list of closed
> issues can be found on the 2.5.2
>  and 2.5.99-TYPED-M1
>  milestones on
> github.
>
> 
> Credits
>
> For this release we had the help of 27 committers – thank you all very
> much!
>
> commits  added  removed
>  44   7021 4706 Patrik Nordwall
>  29  2045322586 Arnout Engelen
>  18   2290 2122 Martynas Mickevičius
>  10   3173 1547 Johan Andrén
>   6272  233 Konrad `ktoso` Malawski
>   5118   17 Richard Imaoka
>   4137   37 andrea
>   3862  426 Peter Vlugter
>   2 37   11 Roland Kuhn
>   2 26   21 Hawstein
>   2 12   12 Philippus Baalman
>   14763 drewhk
>   1 66   21 Johannes Rudolph
>   1 22   22 stanislav
>   1 289 Chris Martin
>   1 185 Nafer Sanabria
>   1  88 Age Mooij
>   1  88 Lukas Phaf
>   1  95 Zahari Dichev
>   1  22 Masaru Nomura
>   1  11 Bartosz Kowalik
>   1  11 Sebastian Gavril
>   

Re: [akka-user] How to load dataase records into ram by akka and java

2017-05-24 Thread Konrad Malawski
You'll still of course use some jdbc driver to pull the data out.
You can use Slick to get a Reactive Stream which you can easily consume
using Akka Streams:

Source.fromPublisher(db.stream(strm.result))

which you could then use mapAsync or other operators on to make it process
more at the same time.

But it'd be the same query..

Or you can use the cluster to fire off multiple queries for a given range
of IDs and thus spreading the loading across the nodes.
Actually, the exact same thing will just work with multiple actors that
would query for a range and populate it thanks to that in parallel.



-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 24 May 2017 at 14:22:53, morteza Davodi (morteza.dav...@gmail.com) wrote:

I want load million records from oracle DB onto ram fast as a possible, my
current solution is very slow, i use pure jdbc code with single thread,
read record per record and store on memcached, i want use akka as a
in-memory database and in-memory computation. before i dirty my hands with
code, i want know available akka's solutions for loading oracle records on
ram instead a traditional jdbc solution.

-- 
>> 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: Actor per process or service ?

2017-05-22 Thread Konrad Malawski
I see, well then it's just about how constrained you want the parallelism
basically which starts to sound like you'd know more about since the actual
operations they will do are very tied to what your app actually does hmm

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 22 May 2017 at 16:22:36, gervais.b (gervai...@gmail.com) wrote:

The beginning of the track will be done by a post-commit hook form our Git
server. However the build and static analysis don't have webhooks so I have
to poll them.

On Monday, 22 May 2017 16:11:26 UTC+2, gervais.b wrote:
>
> Hi there,
>
> I'm going to write a "*commit tracker*" that will follow and a source
> code commit from our Git server trough the build until the static analysis.
> The goal is to display and update a message like "Commit xyz received,
> (delay) and build succesfully, (delay) and incerase quality of 1%".
> Sadly I have to poll either the build server and the static analysis to
> know when a result is available.
>
>
> My question is. Knwong that I have to poll the server, is it better to
> create on actor per server and send them a message like 'GetStatus'. Or one
> actor per commit that will continually send messages to the servers until
> it get result ?
>
> 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.

-- 
>>  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] Actor per process or service ?

2017-05-22 Thread Konrad Malawski
I did a similar thing in the past, however we were able to not poll, by
using https://git-scm.com/book/gr/v2/Customizing-Git-Git-Hooks on the
server - sure you can't do that? If it's a hosted repo perhaps they provide
other hooks?

In general though - the question is how many processes doing fetching at
the same time do you want.
I think per server likely makes sense, though with a limit how many at the
same time can issue the git commands - (modeled as actors again most likely)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 22 May 2017 at 16:11:29, gervais.b (gervai...@gmail.com) wrote:

Hi there,

I'm going to write a "*commit tracker*" that will follow and a source code
commit from our Git server trough the build until the static analysis. The
goal is to display and update a message like "Commit xyz received, (delay)
and build succesfully, (delay) and incerase quality of 1%".
Sadly I have to poll either the build server and the static analysis to
know when a result is available.


My question is. Knwong that I have to poll the server, is it better to
create on actor per server and send them a message like 'GetStatus'. Or one
actor per commit that will continually send messages to the servers until
it get result ?

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.

-- 
>>  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] Could not resolve substitution to a value: ${akka.stream.blocking-io-dispatcher}

2017-05-18 Thread Konrad Malawski
Hi there,

> case x => MergeStrategy.first

is wrong. Configuration must be concated - so all reference.conf and
application.conf must be concated together.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 18 May 2017 at 14:53:55, tj5...@tutanota.com (tj5...@tutanota.com) wrote:

I am trying to incorporate akka http to spark. when submitting job with
command

spark-submit --class example.MyHttp
/path/to/target/scala-2.11/my-assembly-0.1.jar

it throws exceptions "Could not resolve substitution to a value:
${akka.stream.blocking-io-dispatcher}"

Exception in thread "main"
com.typesafe.config.ConfigException$UnresolvedSubstitution: reference.conf
@
jar:file:/path/to/project/target/scala-2.11/my-assembly-0.1.jar!/reference.conf:
42: Could not resolve substitution to a value:
${akka.stream.blocking-io-dispatcher}
at
com.typesafe.config.impl.ConfigReference.resolveSubstitutions(ConfigReference.java:108)
at
com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179)
at
com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)
at
com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:379)
at
com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:312)
at
com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:398)
at
com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179)
at
com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)
at
com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:379)
at
com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:312)

After googling a bit, it seems to be the problem when merging multiple
reference.conf files. But I don't find a solution for this problem.

My sbt looks below

scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-http" % "10.0.6",
  "com.typesafe.akka" %% "akka-http-xml" % "10.0.6",
  "org.apache.spark" %% "spark-streaming" % "2.1.0" % "provided",
  "com.typesafe" % "config" % "1.3.1",
  "org.scalatest" %% "scalatest" % "2.2.6" % "test"
)

assemblyMergeStrategy in assembly := {
 case PathList("META-INF", xs @ _*) => MergeStrategy.discard
 case x => MergeStrategy.first
}

How can I fix it? I appreciate any suggestions. 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.

-- 
>>  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] How to map unstructured Json to a case class in Akka-Http

2017-05-13 Thread Konrad Malawski
Please read the docs about json support:
http://doc.akka.io/docs/akka-http/current/scala/http/common/json-support.html

You're likely missing SprayJsonSupport

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 13 May 2017 at 10:47:51, vishal.ve...@exadatum.com (
vishal.ve...@exadatum.com) wrote:


I am trying to create the REST service using akka Http and slick . I am
trying to persist the Raw json in the MySql table in string format or BLOB
format whichever can solve my problem.
The point where I am facing issues is Every time I try to store the Json
via akka http routes , It throws an error about json being malformed.

object Models {
  case class Customer(name: String,jsonData:String)
  object ServiceJsonProtoocol extends DefaultJsonProtocol {
implicit val customerProtocol = jsonFormat2(Customer)
  }
}

object AkkaJsonParsing {



  def main(args: Array[String]) {

implicit val actorSystem = ActorSystem("rest-api")

implicit val actorMaterializer = ActorMaterializer()

val list = new ConcurrentLinkedDeque[Customer]()

import ServiceJsonProtoocol.customerProtocol
val route =
  path("customer") {
post {
  entity(as[Customer]) {
customer => complete {
  list.add(customer)
  s"got customer json ${customer.jsonData}"
}
  }
}





Json
{
"name":"test",
   "json":[{"type":"alpha","gross":"alpha"}]

}



Error :Request was rejected with rejection
MalformedRequestContentRejection(Expected String as JsString, but got
[{"type":"alpha","gross":"alpha"}],None)


I tried changing case class jsonData datatype to Byte,Array[Byte] but
nothing helps.
what is the right way to persist whole json?

--
>> 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] Use case for a customized dispatcher

2017-05-11 Thread Konrad Malawski
You likely don't need to, ever.
In fact, we won't be supporting writing your own in Akka Typed.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 11 May 2017 at 18:20:06, Dai Yinhua (yhdai.2...@gmail.com) wrote:

I don't know, I'm reading through Akka document, so just wondering why Akka
provides customized dispatcher and in what case should write customized
dispatchers.
--
>> 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] Use case for a customized dispatcher

2017-05-11 Thread Konrad Malawski
Hi there,
I don't think you need to write a custom dispatcher - do you have evidence
that you need to implement your own?

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 11 May 2017 at 18:00:14, Dai Yinhua (yhdai.2...@gmail.com) wrote:

Hi Akka team,

In http://doc.akka.io/docs/akka/current/java/dispatchers.html, it said

The default dispatcher gives excellent performance in most cases

I just want to know in what case the default dispatcher is not performing
good, and when we write customized dispatcher, which kind of
dispatcher(Pinned or CallingThread) is suitable for which case?
Do you have a guideline for that?

Thank you.
--
>> 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] Restart stream with backoff

2017-05-09 Thread Konrad Malawski
The hosting within an Actor is a perfectly fine and valid solution IMHO.

On Tue, May 9, 2017 at 4:04 PM, 'Michal Borowiecki' via Akka User List <
akka-user@googlegroups.com> wrote:

> Sounds like what could help in your organization is using a higher-level
> abstraction, such as Lagom.
>
> You don't need to be comfortable with actors to use it and it does provide
> a wrapper around reactive-kafka (or akka-stream-kafka as it's currently
> known) with exponential backoff restarts:
>
> https://www.lagomframework.com/documentation/1.3.x/java/KafkaClient.html
> If you decide to explore that route, there's a lagom framework mailing
> list: lagom-framew...@googlegroups.com
>
> Cheers,
> Michał
>
>
> On 08/05/17 20:56, Richard Rodseth wrote:
>
> I was hoping to promote a pattern in my organization, using reactive-kafka
> (source-per-partition). Some of my colleagues are comfortable with actors,
> but it would be great if others could be introduced to the streams APIs
> without learning all about actors.
>
> Am I correct that there is currently no way to restart a stream with
> exponential backoff, other than running the stream in a "host" actor that
> runs the stream and is fed stream elements using alsoTo ?
>
> Backoff supervision is one of the items mentioned here:
> https://github.com/akka/akka/issues/19950
>
> Anyone else come up with a creative solution?
>
>
>
>
> --
> >> 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.
>
>
> --
>  Michal Borowiecki
> Senior Software Engineer L4
> T: +44 208 742 1600 <+44%2020%208742%201600>
>
>
> +44 203 249 8448 <+44%2020%203249%208448>
>
>
>
> E: michal.borowie...@openbet.com
> W: www.openbet.com
> OpenBet Ltd
>
> Chiswick Park Building 9
>
> 566 Chiswick High Rd
>
> London
>
> W4 5XT
>
> UK
> 
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> postmas...@openbet.com and delete it from your system as well as any
> copies. The content of e-mails as well as traffic data may be monitored by
> OpenBet for employment and security purposes. To protect the environment
> please do not print this e-mail unless necessary. OpenBet Ltd. Registered
> Office: Chiswick Park Building 9, 566 Chiswick High Road, London, W4 5XT,
> United Kingdom. A company registered in England and Wales. Registered no.
> 3134634. VAT no. GB927523612
>
> --
> >> 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,
Konrad 'ktoso' Malawski
Akka  @ Typesafe 

-- 
>>  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] Confusion in documentation regarding HTTPS support in Akka HTTP

2017-05-08 Thread Konrad Malawski
As documented:

* If an explicit [[ConnectionContext]] is given then it rather than
the configured default [[ConnectionContext]] will be used
* for setting up the HTTPS connection pool, if the request is targeted
towards an `https` endpoint.


-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 8 May 2017 at 19:52:09, Henrik Larsson (favetelingu...@gmail.com) wrote:

Nice thanks I got it working now! However is there a way to set HTTPS
settings on the Http().singleRequest? The docs says it uses the default but
i just want to set the HTTPS setting on this speficic request, all others
should have another setting.

On Monday, May 8, 2017 at 8:19:19 AM UTC+2, Konrad Malawski wrote:
>
> It's plain Java, configure the SSLContext as usual and provide it to the
> HttpsConnectionContext.
>
> --
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 8 May 2017 at 15:18:21, Henrik Larsson (favetel...@gmail.com) wrote:
>
> Ok thanks, so far I have found this example wich i guess i can make work
> on the client side also https://github.com/rklaehn/akkahttpsserver/blob/
> master/src/main/scala/httpsserver/Server.scala
> However I would like to send the key and crt separate and in the exampel
> they use p12. Is there any example on how to configure with a case like
> this?
>
> On Monday, May 8, 2017 at 8:09:26 AM UTC+2, Konrad Malawski wrote:
>>
>> My guess right now is that they do the same thing but the part under
>> SSL-Config sets up the system default HttpsContext, is this correct?
>>
>> Yes, that's the case.
>>
>> SSLConfig is merely a helper utility you can use to easily set up things.
>> You can not use it if you don't want to.
>>
>>
>> --
>> Konrad `ktoso` Malawski
>> Akka <http://akka.io> @ Lightbend <http://lightbend.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+...@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.

-- 
>>>>>>>>>>  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] Confusion in documentation regarding HTTPS support in Akka HTTP

2017-05-08 Thread Konrad Malawski
Sure, explore it's parameters (HttpsConnectionContext) :-)

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 8 May 2017 at 19:52:09, Henrik Larsson (favetelingu...@gmail.com) wrote:

Nice thanks I got it working now! However is there a way to set HTTPS
settings on the Http().singleRequest? The docs says it uses the default but
i just want to set the HTTPS setting on this speficic request, all others
should have another setting.

On Monday, May 8, 2017 at 8:19:19 AM UTC+2, Konrad Malawski wrote:
>
> It's plain Java, configure the SSLContext as usual and provide it to the
> HttpsConnectionContext.
>
> --
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 8 May 2017 at 15:18:21, Henrik Larsson (favetel...@gmail.com) wrote:
>
> Ok thanks, so far I have found this example wich i guess i can make work
> on the client side also https://github.com/rklaehn/akkahttpsserver/blob/
> master/src/main/scala/httpsserver/Server.scala
> However I would like to send the key and crt separate and in the exampel
> they use p12. Is there any example on how to configure with a case like
> this?
>
> On Monday, May 8, 2017 at 8:09:26 AM UTC+2, Konrad Malawski wrote:
>>
>> My guess right now is that they do the same thing but the part under
>> SSL-Config sets up the system default HttpsContext, is this correct?
>>
>> Yes, that's the case.
>>
>> SSLConfig is merely a helper utility you can use to easily set up things.
>> You can not use it if you don't want to.
>>
>>
>> --
>> Konrad `ktoso` Malawski
>> Akka <http://akka.io> @ Lightbend <http://lightbend.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+...@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.

-- 
>>>>>>>>>>  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] Lookup custom header in response headers

2017-05-08 Thread Konrad Malawski
I made it work in Scala: https://github.com/akka/akka-http/pull/1103
It's a bit sneaky internally, but I'd be ok with such impl.
Sadly it does not translate directly to JavaDSL and that we'll have to deal
with in a different style.

On Mon, May 8, 2017 at 4:21 PM, Greg Methvin <g...@lightbend.com> wrote:

> Okay, that makes sense. Thanks Konrad.
>
> On Sun, May 7, 2017 at 10:27 PM, Konrad Malawski <
> konrad.malaw...@lightbend.com> wrote:
>
>> To clarify: You'll notice that it does actually work in the routing DSL,
>> even if you supply a RawHeader it will attempt to extract the typed modeled
>> header that you provide it with.
>>
>> This actually does work in the routing DSL:
>>
>>   val routes = headerValueByType[*ApiTokenHeader*]() { token ⇒
>> complete(s"extracted> $token")
>>   }
>>
>>   Get().withHeaders(*RawHeader*("apiKey", "TheKey")) ~> routes ~>
>> check {
>> status should ===(StatusCodes.OK)
>> responseAs[String] should ===("extracted> apiKey: TheKey") // so
>> it matched the custom one
>>   }
>>
>> https://github.com/akka/akka-http/blob/master/akka-http-test
>> s/src/test/scala/akka/http/scaladsl/server/ModeledCustomHead
>> erSpec.scala#L113:L120
>>
>> Seems we omitted to add the special logic that can do this to the
>> HttpRequest / HttpResponse itself, since they are "low level",
>> and usually did not do these things... I'll take a look if we could add
>> that infrastructure there without breaking binary compatibility.
>>
>> --
>> Konrad `ktoso` Malawski
>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>
>> On 7 May 2017 at 20:56:22, Marco Yuen (mar...@gmail.com) wrote:
>>
>> Hi Konrad,
>>
>> I'm don't mean to hijack the thread, but I'm having the same question.
>> Here is the custom header:
>>
>> final case class RateLimitLimit(limit: String) extends 
>> ModeledCustomHeader[RateLimitLimit] {
>>   override def companion: ModeledCustomHeaderCompanion[RateLimitLimit] = 
>> RateLimitLimit
>>
>>   override def renderInRequests(): Boolean = true
>>
>>   override def renderInResponses(): Boolean = true
>>
>>   override def value(): String = limit
>> }
>>
>> object RateLimitLimit extends ModeledCustomHeaderCompanion[RateLimitLimit] {
>>   override def name: String = "X-RateLimit-Limit"
>>
>>   override def parse(value: String): Try[RateLimitLimit] = 
>> Success(RateLimitLimit(value))
>> }
>>
>>
>> When I tried to extract the header from HttpResponse using
>> resp.header[RateLimitLimit], I always get None. However, if I use
>> resp.header[RawHeader], I will get my custom header back, but only if
>> there only one custom header in the response. If the response contains more
>> than one custom headers, resp.header[RawHeader] will return first custom
>> header.
>>
>> I'm using akka-http 10.0.6 and akka 2.5.1.
>>
>> Best,
>> Marco
>>
>> On Monday, April 24, 2017 at 5:46:13 AM UTC-4, Konrad Malawski wrote:
>>>
>>> Hi Kyrylo,
>>> Would you mind sharing your code for the transaction id header?
>>>
>>> That way of extracting a header does work, and I've added a test as we
>>> were missing that specific style actually:
>>> https://github.com/akka/akka-http/pull/1047
>>>
>>> I suspect you may have done something wrong in your header definition -
>>> are you sure you defined everything that's needed?
>>>
>>>
>>> See this test for more usage examples: https://github.com/a
>>> kka/akka-http/blob/master/akka-http-tests/src/test/scala/akk
>>> a/http/scaladsl/server/ModeledCustomHeaderSpec.scala
>>>
>>> On Fri, Apr 21, 2017 at 4:23 PM, Kyrylo Stokoz <k.st...@gmail.com>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> I`m trying to extract custom header from response object like this:
>>>>
>>>> response.header[`X-Transaction-Id`]
>>>>
>>>>
>>>> but it always give me None, changing it to lookup by name return expected 
>>>> value.
>>>>
>>>>
>>>> response.headers.find(_.lowercaseName() == 
>>>> `X-Transaction-Id`.name.toLowerCase)
>>>>
>>>>
>>>> It looks like it is related to modeling custom headers as RawHeader.
>>>>
>>>> According to 
>>>> http://doc.akka.i

Re: [akka-user] Confusion in documentation regarding HTTPS support in Akka HTTP

2017-05-08 Thread Konrad Malawski
It's plain Java, configure the SSLContext as usual and provide it to the
HttpsConnectionContext.

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 8 May 2017 at 15:18:21, Henrik Larsson (favetelingu...@gmail.com) wrote:

Ok thanks, so far I have found this example wich i guess i can make work on
the client side also
https://github.com/rklaehn/akkahttpsserver/blob/master/src/main/scala/httpsserver/Server.scala
However I would like to send the key and crt separate and in the exampel
they use p12. Is there any example on how to configure with a case like
this?

On Monday, May 8, 2017 at 8:09:26 AM UTC+2, Konrad Malawski wrote:
>
> My guess right now is that they do the same thing but the part under
> SSL-Config sets up the system default HttpsContext, is this correct?
>
> Yes, that's the case.
>
> SSLConfig is merely a helper utility you can use to easily set up things.
> You can not use it if you don't want to.
>
>
> --
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.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 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] Confusion in documentation regarding HTTPS support in Akka HTTP

2017-05-08 Thread Konrad Malawski
My guess right now is that they do the same thing but the part under
SSL-Config sets up the system default HttpsContext, is this correct?

Yes, that's the case.

SSLConfig is merely a helper utility you can use to easily set up things.
You can not use it if you don't want to.


-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

-- 
>>  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] Lookup custom header in response headers

2017-05-07 Thread Konrad Malawski
To clarify: You'll notice that it does actually work in the routing DSL,
even if you supply a RawHeader it will attempt to extract the typed modeled
header that you provide it with.

This actually does work in the routing DSL:

  val routes = headerValueByType[*ApiTokenHeader*]() { token ⇒
complete(s"extracted> $token")
  }

  Get().withHeaders(*RawHeader*("apiKey", "TheKey")) ~> routes ~> check
{
status should ===(StatusCodes.OK)
responseAs[String] should ===("extracted> apiKey: TheKey") // so it
matched the custom one
  }

https://github.com/akka/akka-http/blob/master/akka-http-tests/src/test/scala/akka/http/scaladsl/server/ModeledCustomHeaderSpec.scala#L113:L120

Seems we omitted to add the special logic that can do this to the
HttpRequest / HttpResponse itself, since they are "low level",
and usually did not do these things... I'll take a look if we could add
that infrastructure there without breaking binary compatibility.

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 7 May 2017 at 20:56:22, Marco Yuen (mar...@gmail.com) wrote:

Hi Konrad,

I'm don't mean to hijack the thread, but I'm having the same question.
Here is the custom header:

final case class RateLimitLimit(limit: String) extends
ModeledCustomHeader[RateLimitLimit] {
  override def companion: ModeledCustomHeaderCompanion[RateLimitLimit]
= RateLimitLimit

  override def renderInRequests(): Boolean = true

  override def renderInResponses(): Boolean = true

  override def value(): String = limit
}

object RateLimitLimit extends ModeledCustomHeaderCompanion[RateLimitLimit] {
  override def name: String = "X-RateLimit-Limit"

  override def parse(value: String): Try[RateLimitLimit] =
Success(RateLimitLimit(value))
}


When I tried to extract the header from HttpResponse using
resp.header[RateLimitLimit], I always get None. However, if I use
resp.header[RawHeader], I will get my custom header back, but only if there
only one custom header in the response. If the response contains more than
one custom headers, resp.header[RawHeader] will return first custom header.

I'm using akka-http 10.0.6 and akka 2.5.1.

Best,
Marco

On Monday, April 24, 2017 at 5:46:13 AM UTC-4, Konrad Malawski wrote:
>
> Hi Kyrylo,
> Would you mind sharing your code for the transaction id header?
>
> That way of extracting a header does work, and I've added a test as we
> were missing that specific style actually:
> https://github.com/akka/akka-http/pull/1047
>
> I suspect you may have done something wrong in your header definition -
> are you sure you defined everything that's needed?
>
>
> See this test for more usage examples: https://github.com/
> akka/akka-http/blob/master/akka-http-tests/src/test/
> scala/akka/http/scaladsl/server/ModeledCustomHeaderSpec.scala
>
> On Fri, Apr 21, 2017 at 4:23 PM, Kyrylo Stokoz <k.st...@gmail.com> wrote:
>
>> Hi All,
>>
>> I`m trying to extract custom header from response object like this:
>>
>> response.header[`X-Transaction-Id`]
>>
>>
>> but it always give me None, changing it to lookup by name return expected 
>> value.
>>
>>
>> response.headers.find(_.lowercaseName() == 
>> `X-Transaction-Id`.name.toLowerCase)
>>
>>
>> It looks like it is related to modeling custom headers as RawHeader.
>>
>> According to 
>> http://doc.akka.io/docs/akka-http/10.0.5/scala/http/common/http-model.html:
>>
>> "Thanks to extending ModeledCustomHeader instead of the plain CustomHeader 
>> such header can be matched"
>>
>>
>> Should it apply to header extraction in the way above as well? Is it a bug? 
>> or as designed?
>>
>>
>> Regards,
>>
>> Kyrylo
>>
>> --
>> >>>>>>>>>> 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.
>>
>
>
>
> --
> Cheers,
> Konrad 'ktoso' Malawski
> Akka <http://akka.io/> @ Typesafe <http://typesafe.com/>
>
--
>>

Re: [akka-user] akka-http Client-Side HTTPS Support MITM Warning

2017-05-03 Thread Konrad Malawski
Hi Ferenc,
please do always read the latest docs - this is an ancient note you
stumbled upon.
"1.0" refers to a version released back in July 2015 (!), at which time we
did not have the certificate checking implemented.

By now it is, and the note is gone from the docs:
http://doc.akka.io/docs/akka-http/current/scala/http/client-side/client-https-support.html


Summing up, the note is old, and it is fixed.
Happy hakking!

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 4 May 2017 at 09:59:52, ferenc.toth via Akka User List (
akka-user@googlegroups.com) wrote:

Hi there,

We're evaluating the usage of akka-http for one of our projects.

I see a warning message on the top of
http://doc.akka.io/docs/akka-http/10.0.0/scala/http/client-side/client-https-support.html
stating the following:
Warning
Akka HTTP 1.0 does not completely validate certificates when using HTTPS.
Please do not treat HTTPS connections made with this version as secure.
Requests are vulnerable to a Man-In-The-Middle attack via certificate
substitution.

I'm wondering what the devs are planning to do to patch this issue and when
the fix is expected.
Also, it would be helpful if there'd be a link to the open issue, so users
can track the status of the fix.

Thanks,
Ferenc

This message, and any attachments, is for the intended recipient(s) only,
may contain information that is privileged, confidential and/or proprietary
and subject to important terms and conditions available at
http://www.digitalasset.com/emaildisclaimer.html. If you are not the
intended recipient, please delete this message. --
>> 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] ANNOUNCE: Akka HTTP 2.4.11.2 Security Patch Released

2017-05-03 Thread Konrad Malawski
Dear hakkers,

We announce the immediate availability of the second security patch for the 
experimental Akka HTTP that was part of the 2.4.x development series. It 
contains an important security fix for a vulnerability that affects all 
Akka HTTP applications that use the routing DSL. The vulnerability allows a 
remote attacker to crash an Akka HTTP server with a simple request so it is 
highly recommended to update to Akka HTTP 10.0.6 as soon as possible. 

Please note that for the latest developments of Akka HTTP you should switch 
to track its 10.0.x series - we strongly suggest upgrading to that version 
since it is the stable and maintained version of Akka HTTP, while the 
2.4.11 version will only be receiving critical security updates for a while.
Compatibility notes

*We strongly suggest upgrading to Akka 10.0.6 or later. *


Akka 10.0.x is backwards binary compatible with previous 10.0.x releases 
and Akka 2.4.x. This means that the new JARs are a drop-in replacement for 
the old one (but not the other way around) as long as your build does not 
enable the inliner (Scala-only restriction). It should be noted that Scala 
2.12.x is is not binary compatible with Scala 2.11.x.
Changes:

This release only contains 2 additional commits 
 over its predecessor, which aim 
to resolve the Accept header vulnerability.
Credits

One critical issue was closed since 2.4.11.1.

The complete list of closed issues can be found on the 2.4.11.2 
 milestones on github.

Happy hakking!

– The Akka Team


-- 
>>  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] ANNOUNCE: Akka-Http 10.0.6 Security Update Released

2017-05-03 Thread Konrad Malawski
Dear hakkers,

We are proud to announce Akka Http 10.0.6, which is the sixth release of 
the Akka Http 10.0 series. It contains an important security fix for a 
vulnerability that affects all Akka HTTP applications that use the routing 
DSL. The vulnerability allows a remote attacker to crash an Akka HTTP 
server with a simple request leading to a denial of service. It is highly 
recommended to update to Akka HTTP 10.0.6 as soon as possible. See the security 
announcement 

 
for more details.

Please subscribe to the akka-security 
 mailing list to be 
notified promptly about future security issues.

This update also contains several maintenance fixes and improvements as 
detailed below.
Compatibility notes

This version is compatible with Akka 2.4.x as well as the current 2.5.1, so 
we encourage you to use Akka 2.5 with this version, as the new completely 
redesigned materializer in Akka Streams can result in various performance 
and memory usage improvements across the board.

If you want to use Akka HTTP together with Akka 2.5.1 make sure to include 
a dependency to akka-stream 2.5.1 and not only to akka-actor 2.5.1 
(otherwise, your app may fail at runtime because of incompatibilities 
between a 2.4.x version of akka-stream and a 2.5.x version of akka-actor).

Akka 10.0.x is backwards binary compatible with previous 10.0.x releases 
and Akka 2.4.x. This means that the new JARs are a drop-in replacement for 
the old one (but not the other way around) as long as your build does not 
enable the inliner (Scala-only restriction). It should be noted that Scala 
2.12.x is is not binary compatible with Scala 2.11.x.
Notable changes:

[copy over from release notes]
Credits

A total 50 issues were closed since 10.0.5.

The complete list of closed issues can be found on the 10.0.6 
 milestones on 
github.

For this release we had the help of 14 contributors – thank you all very 
much!

Credits:

commits  added  removed

16581  104 Konrad `ktoso` Malawski

13320   93 Josep Prat

10464  210 Johannes Rudolph

 5119   30 Arnout Engelen

 4131   44 Jonas Fonseca

 4 37   13 Bartłomiej Tomala

 3102   13 michael-smith

 2  33 Barnabás Oláh

 1 398 Jan Ypma

 1 219 Aurélien Thieriot

 1 211 Richard S. Imaoka

 1 192 Hugh

 1  64 Patrik Nordwall

 1  11 MiR


Happy hakking!

– The Akka Team




-- 
>>  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 Flow map from X to X, the materialize

2017-05-03 Thread Konrad Malawski
A flow is not something you can run - it's defined as "one open input, one
open output".
What the method fromSinkAndSource builds is like a flow made from two
discrete parts.
Imagine that it's input will be drained to the given sink, and it's output
IS the source you gave it.

If you just want to run the code you provided there you just compose them,
without any fromSinkAndSource which is a very specific advanced thing :-)

So just

Source.range(1, 100).map(v -> new X()).to(Sink.foreach(v ->
System.out.println(v))).run()



I recommend you start with reading the docs from the beginning about Akka
Streams, they explain how they work :)

Happy hakking.


-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 3 May 2017 at 21:33:06, 'Michal Borowiecki' via Akka User List (
akka-user@googlegroups.com) wrote:

Hi Igmar,

You can do a map on the source and pass the new returned Source as the
second parameter to Flow.fromSinkAndSource instead of the original source.

Something like this (untested):
final Source source = Source.range(1, 100).map(v -> new X());
final Sink sink = Sink.foreach(v ->
System.out.println(v));
final Flow flow = Flow.fromSinkAndSource(sink, source);

Hope that helps,

Michał
On 03/05/17 10:42, Igmar Palsenberg wrote:


Hi,

I'm starting to learn the basics of Akka Streams, and I have this :

final Source source = Source.range(1, 100);
final Sink sink = Sink.foreach(v ->
System.out.println(v));
final Flow flow = Flow.fromSinkAndSource(sink, source);

What I'v read from the docs :

Flow
A processing stage which has *exactly one input and output*, which connects
its up- and downstreams by transforming the data elements flowing through
it.

If I understand correctly, I could transform an Integer to an X. A map on
flow doesn't work, since that requires an Integer to be returned. I tried :

Flow x = flow.map(v -> return new X() );

but then I can't materialize the flow using runWith, since it requires both
a sink and a source (why ?? Since fromSinkAndSource already provided that).

Can someone shed a light on this ?


Regards,


Igmar


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


--
 Michal Borowiecki
Senior Software Engineer L4
T: +44 208 742 1600


+44 203 249 8448



E: michal.borowie...@openbet.com
W: www.openbet.com
OpenBet Ltd

Chiswick Park Building 9

566 Chiswick High Rd

London

W4 5XT

UK

This message is confidential and intended only for the addressee. If you
have received this message in error, please immediately notify the
postmas...@openbet.com and delete it from your system as well as any
copies. The content of e-mails as well as traffic data may be monitored by
OpenBet for employment and security purposes. To protect the environment
please do not print this e-mail unless necessary. OpenBet Ltd. Registered
Office: Chiswick Park Building 9, 566 Chiswick High Road, London, W4 5XT,
United Kingdom. A company registered in England and Wales. Registered no.
3134634. VAT no. GB927523612
--
>> 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 

Re: [akka-user] Akka-streams supervision: best practices

2017-05-02 Thread Konrad Malawski
Hi Alexander,
since you asked the same question on the issue tracker at the same time
allow me to link those and let's continue the discussion here if you want;

https://github.com/akka/akka/issues/21192#issuecomment-298806620


Firstly: I don't think that's entirely true. Existing supervision indeed
only works when stages "support it". One has to notice that it's not as
simple as it may seem from a high level perspective, since there's buffers
involved between stages so what would "restart a section", or what *should*
 it *really* mean etc.

However, there's many ways to add restarting or other behaviours.

Including, but not limited to:

   - Retry -
   
https://github.com/akka/akka-stream-contrib/blob/master/contrib/src/main/scala/akka/stream/contrib/Retry.scala
   - recoverWith
   
http://doc.akka.io/docs/akka/2.5.1/scala/stream/stages-overview.html#recoverWith
   - recoverWithRetries
   
http://doc.akka.io/docs/akka/2.5.1/scala/stream/stages-overview.html#recoverWithRetries
   - mapError
   http://doc.akka.io/docs/akka/2.5.1/scala/stream/stages-overview.html#mapError
   - and more stages, such as watchTermination, monitor etc.
   - the existing supervision when it's enough
   - or hosting within Actors and reacting to a termination with how you
   want.

Do bear in mind that Akka was, is and remains a toolkit. The tools are
there, with killswitches, a spec how failure is propagated (reactive
streams, which will be in JDK9)

Would we want to improve the current supervision scheme?
Yes, we'd like to. Are we right now going to work on it? No, we're focused
on other areas right now that are more pressing.

What would be helpful now: What I think would be the best next step here,
is to actually *come up with patterns* - be it as blogs, or writeups in
issues or PRs that pre-package behaviour such as the Retry stage did, and
once we have the real use cases we can think about it again, because a
*generic* "supervision" is very hard (note the generic part in that phrase,
specialized ones are simple), and *very* likely not what you'd actually
want (it would do unexpected surprising things, we experimented with some
restarting schemes).

I do agree though that all those patterns should be then collected and put
to: http://doc.akka.io/docs/akka/2.5.1/scala/stream/stream-error.html We're
right now working on a new docs and website page, so once that's done we'll
focus on such content.

Hope this answers the question about status, next steps, and how you can
help :-)



-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 3 May 2017 at 08:20:50, Alexander Temerev (sor...@gmail.com) wrote:

Hi everyone,

Is there any example or document describing best practices for supervising
and monitoring akka streams? E.g. restarting Websocket streams on
disconnect, backing off on repeated failures, creating supervision groups
(e.g. if some stream failed, I also want to fail other streams in the group
and restart them at once), making supervision hierarchies, etc.

Streams are incredibly handy and well-typed, but I don't see yet how I can
recreate these powerful supervision tools available in plain Akka,
especially in dynamic flow graphs where streams can be attached and
detached at runtime.

"Introduction to streams lifecycle" would be incredibly handy, if it exists
somewhere.

Best,
Alexander
--
>> 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] Graph materialized value of websocket upgrade

2017-05-02 Thread Konrad Malawski
-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 2 May 2017 at 23:28:51, Mathieu Bruyen (mathbru...@gmail.com) wrote:

It looks a bit unnatural, should there be a way of doing this similar to
the client one (in which the materialized value is directly returned)?

There is one big difference, the client *you* materialize, so you can get
back the value easily, the server however materializes it for you, so
you've passed it out and don't have a simple way of getting it back in hand.

Please open a ticket about that; technically it will be the exact same
operation, however perhaps we can add a different name for it, like expose
or something hm.


If mapMaterializedValue is the way to go, does it deserve a mention in the
documentation (I can create the PR for that)?

Please open a ticket or send in a PR about that :-)




On Tuesday, May 2, 2017 at 12:42:43 PM UTC+2, Konrad Malawski wrote:
>
> Sorry for the brief response, quite a lot of text in there :)
>
> Yeah, mapMaterializedValue is a way to getting it out and side effecting
> it into somewhere.
>
> --
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 2 May 2017 at 19:35:32, Mathieu Bruyen (mathb...@gmail.com) wrote:
>
> Hello,
>
> (this is more related to akka-http but there seem to be no dedicated group)
>
> I am trying to setup a websocket server for which there is no 1-1 relation
> between incoming and outgoing messages. The client can send messages at any
> time which may or not have a reply from the server. The server can push
> messages at any time which may or not have a reply from the client. I
> wanted to let actors handle and produce these messages. Following the doc
> <http://doc.akka.io/docs/akka-http/current/java/http/server-side/websocket-support.html#handling-messages>
>  I am using Sink#actorRefWithAck to push incoming messages to the
> entrypoint/router actor and let it do it's job. For outgoing messages in
> the options suggested by the doc
> <http://doc.akka.io/docs/akka/current/scala/stream/stream-integrations.html#Integrating_with_Actors>
>  I was planning to use Source#queue and give this queue to all the actors
> which might need to push to the queue. I targeted this solution because it
> allows for backpressure management.
>
> My issue is that I need access to the queue materialized value (in order
> to call offer) but WebSocket#handleWebSocketRequestWith does not provide
> access to it. It returns only the HttpResponse to send back to the client.
>
> Source<Message, SourceQueueWithComplete> queue =
> Source.queue(5, OverflowStrategy.backpressure());
> Sink<Message, NotUsed> sink = Sink.actorRefWithAck(tunnel, Messages.INIT,
> Messages.ACK, Messages.COMPLETE, this::onError);
> Flow<Message, Message, SourceQueueWithComplete> flow =
> Flow.fromSinkAndSourceMat(sink, queue, Keep.right());
> HttpResponse response = WebSocket.handleWebSocketRequestWith(request,
> greeterFlow);
>
> I tried the "lower level" UpgradeToWebSocket#handleMessagesWith but got
> to the same conclusion: only the HTTP response is returned back:
>
> HttpResponse response = ((UpgradeToWebSocket)header).handleMessagesWith(sink,
> queue);
>
> I worked around the issue by using mapMaterializedValue, which gives me
> the materialized value which I can give to my handler actor for them to
> publish on. But it sounds like a hack and I would prefer not having side
> effects in mapMaterliazedValue:
>
> Source.queue(5, OverflowStrategy.backpressure())
> .mapMaterializedValue(sourceQueue -> { 
> tunnel.tell(InitTunnel.create(sourceQueue),
> Actor.noSender()); return sourceQueue; });
>
> On the other side, the client gives it back:
>
> Pair<CompletionStage, 
> SourceQueueWithComplete>
> pair =
> http.singleWebSocketRequest(WebSocketRequest.create(connect),
> flow, materializer);
>
> I wonder if I am misusing the API or there is a miss here. If nothing in
> the API lets users do that, would that be a desirable addition?
>
> While debugging I saw that the graph is materialized after the response is
> sent back, so there might be a technical limitation which I am not aware of
> that forces to materialize the graph later.
> --
> >>>>>>>>>> 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 g

Re: [akka-user] Akka and RDMA

2017-05-02 Thread Konrad Malawski
I'd read that note as "it is possible to put it onto RDMA" :-)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 2 May 2017 at 19:35:31, Marc Christoph (facelessto...@gmail.com) wrote:

Apologies, Michal. The resource containing the (brief) mention of RDMA can
be found here
, under
"Design Assumptions". I'll quote it here for convenience.

*"The Aeron protocol is designed to be run directly over many different
types of transmission media, including shared memory/IPC, InfiniBand/RDMA,
UDP, TCP, Raw IP, HTTP, WebSocket, BLE, etc. This means that the following
assumptions are made:*

   - *Transmission Media may be a stream media, such as TCP or RDMA without
   inherent frame boundaries.*
   - *..."*

Marc

On Tuesday, 2 May 2017 11:00:42 UTC+2, Michal Borowiecki wrote:
>
> Hi Marc,
>
> Sounds very interesting but I couldn't find evidence of Aeron directly
> supporting RDMA in the links your provided or otherwise. Can you please
> point me to your sources?
>
> I found this github ticket https://github.com/real-logic/Aeron/issues/220
> but it's still open.
>
> Thanks,
>
> Michal
>
> On 02/05/17 09:43, Marc Christoph wrote:
>
> Hi, everyone
>
> I am having some issues understanding the implementation details of RDMA
> and whether it is supported by Akka. According to this blog post
> , Akka is using
> Aeron  as an underlying transport in
> the remoting implementation, and Aeron supports RDMA. However, I am unsure
> of how to leverage it in my own applications. From what I understand, RDMA
> is a feature of the network adapter, but I do not know if I need to
> explicitly make use of it in my code? Or if Akka provides functionality to
> do so?
>
> Thanks in Advance
>
> Marc
> --
> >> 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.
>
>
> --
>  Michal Borowiecki
> Senior Software Engineer L4
> T: +44 208 742 1600
>
>
> +44 203 249 8448
>
>
>
> E: michal.b...@openbet.com
> W: www.openbet.com
> OpenBet Ltd
>
> Chiswick Park Building 9
>
> 566 Chiswick High Rd
>
> London
>
> W4 5XT
>
> UK
> 
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> ...@openbet.com and delete it from your system as well as any copies. The
> content of e-mails as well as traffic data may be monitored by OpenBet for
> employment and security purposes. To protect the environment please do not
> print this e-mail unless necessary. OpenBet Ltd. Registered Office:
> Chiswick Park Building 9, 566 Chiswick High Road, London, W4 5XT, United
> Kingdom. A company registered in England and Wales. Registered no. 3134634.
> VAT no. GB927523612
>
--
>> 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] Graph materialized value of websocket upgrade

2017-05-02 Thread Konrad Malawski
Sorry for the brief response, quite a lot of text in there :)

Yeah, mapMaterializedValue is a way to getting it out and side effecting it
into somewhere.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 2 May 2017 at 19:35:32, Mathieu Bruyen (mathbru...@gmail.com) wrote:

Hello,

(this is more related to akka-http but there seem to be no dedicated group)

I am trying to setup a websocket server for which there is no 1-1 relation
between incoming and outgoing messages. The client can send messages at any
time which may or not have a reply from the server. The server can push
messages at any time which may or not have a reply from the client. I
wanted to let actors handle and produce these messages. Following the doc

I am using Sink#actorRefWithAck to push incoming messages to the
entrypoint/router actor and let it do it's job. For outgoing messages in
the options suggested by the doc

I was planning to use Source#queue and give this queue to all the actors
which might need to push to the queue. I targeted this solution because it
allows for backpressure management.

My issue is that I need access to the queue materialized value (in order to
call offer) but WebSocket#handleWebSocketRequestWith does not provide
access to it. It returns only the HttpResponse to send back to the client.

Source queue =
Source.queue(5, OverflowStrategy.backpressure());
Sink sink = Sink.actorRefWithAck(tunnel, Messages.INIT,
Messages.ACK, Messages.COMPLETE, this::onError);
Flow flow =
Flow.fromSinkAndSourceMat(sink, queue, Keep.right());
HttpResponse response = WebSocket.handleWebSocketRequestWith(request,
greeterFlow);

I tried the "lower level" UpgradeToWebSocket#handleMessagesWith but got to
the same conclusion: only the HTTP response is returned back:

HttpResponse response =
((UpgradeToWebSocket)header).handleMessagesWith(sink, queue);

I worked around the issue by using mapMaterializedValue, which gives me the
materialized value which I can give to my handler actor for them to publish
on. But it sounds like a hack and I would prefer not having side effects in
mapMaterliazedValue:

Source.queue(5, OverflowStrategy.backpressure())
.mapMaterializedValue(sourceQueue -> {
tunnel.tell(InitTunnel.create(sourceQueue), Actor.noSender()); return
sourceQueue; });

On the other side, the client gives it back:

Pair pair =
http.singleWebSocketRequest(WebSocketRequest.create(connect), flow,
materializer);

I wonder if I am misusing the API or there is a miss here. If nothing in
the API lets users do that, would that be a desirable addition?

While debugging I saw that the graph is materialized after the response is
sent back, so there might be a technical limitation which I am not aware of
that forces to materialize the graph later.
--
>> 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] Akka REST API - Path Param vs Headers

2017-04-29 Thread Konrad Malawski
I suggest you have a look at some guides about REST in general :) path
should be used to identify a resource, such as person/367 and
person/367/activity etc. headers are used for other things, but should not
really be for resource identification. Could be auth or similar things for
example.

-- 
Konrad Malawski

On April 29, 2017 at 23:19:30, Arun (sethia.a...@gmail.com) wrote:

> Hi,
>
> I am using Akka HTTP routes to define Akka HTTP REST end points.
>
> Are there any guidelines that says "we should not use path param, and try
> to use header", if yes in what  all cases it should be followed?
>
> for example a URI  like /students/{state}/{dept} vs using  using URI
> /staudents and pass state , dept as header value...
>
>
> Thanks for your help.
>
> Regards,
> Arun
>
> --
> >>>>>>>>>> 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] akka stream kafka newbie question

2017-04-27 Thread Konrad Malawski
A Sink is a Graph; as is a Flow, and a Source - they're all graphs, of a
specific shape.
Here, the method takes a Graph @ Lightbend 

On 28 April 2017 at 08:36:43, Shannon Ma (shanno...@gmail.com) wrote:

Hi,

I am new to akka stream kafka, and am trying to follow some the examples to
get start.

I try to use

Source.runWith(Sink.ignore()) or
Soruce.runWith(Producer.commitableSink(producerSettings)

and get this compilation error

The method
runWith(Graph>,M>,
Materializer) in the type
Source,Consumer.Control>
is not applicable for the arguments
(Sink,CompletionStage>,
null)


The method expects Graph<>, but examples put Sink, what am i missing?

Thanks
Shannon
--
>> 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] Actor name is not unique after termination when running from unit tests

2017-04-27 Thread Konrad Malawski
In other words, only the *parent* of the stopped actor can safely "aha!
I've seen it stopped, so I'll start a new one with the same name".
This is documented behavior in the Actor docs :)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 28 April 2017 at 00:17:38, Viktor Klang (viktor.kl...@gmail.com) wrote:

Hi Piotr,

the test thread having observed the termination does not mean that the user
guardian (/user) has observed it.

On Thu, Apr 27, 2017 at 4:53 PM, Piotr Droździel 
wrote:

> Hello,
> Akka docs say:
>
>> Warning
>>
>> Keep in mind that an actor stopping and its name being deregistered are
>> separate events which happen asynchronously from each other. Therefore it
>> may be that you will find the name still in use after gracefulStop() 
>> returned.
>> In order to guarantee proper deregistration, only reuse names from within a
>> supervisor you control and only in response to a Terminated message,
>> i.e. not for top-level actors.
>>
>
> But when testing one of the actors I get InvalidActorNameException even
> after expectTerminated was successful. This is the test:
>
>
> "stop self when finished" in {
>  val fetcher = system.actorOf(EventFetcherActor.props(eventId), "name1")
>
>  watch(fetcher)
>  // interact with the actor, it will call context.stop(self) after
> interaction
>  expectTerminated(fetcher)
>
>  system.actorOf(EventFetcherActor.props(eventId), "name1") //Exception
> thrown
> }
>
> 90% of times I run it, the test passes. But what is the reason of
> failures? Can it be related to the fact that it's unit test?
>
> This is exception message I get:
> actor name [name1] is not unique!
> akka.actor.InvalidActorNameException: actor name [name1] is not unique!
> at akka.actor.dungeon.ChildrenContainer$NormalChildrenContainer.
> reserve(ChildrenContainer.scala:129)
> at akka.actor.dungeon.Children$class.reserveChild(Children.scala:130)
> at akka.actor.ActorCell.reserveChild(ActorCell.scala:374)
> at akka.actor.dungeon.Children$class.makeChild(Children.scala:268)
> at akka.actor.dungeon.Children$class.attachChild(Children.scala:46)
> --
> >> 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.

-- 
>>  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/JSON: Rejecting requests with unknown fields

2017-04-26 Thread Konrad Malawski
That Jackson support is for JavaDSL though - do not mix the DSLs.
It is absolutely possible and supported to use Jackson in ScalaDSL though:
It's implemented by Heiko's library here:
https://github.com/hseeberger/akka-http-json

Hope this helps -

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 27 April 2017 at 01:59:42, Henrik Nordvik (henri...@gmail.com) wrote:

On Wednesday, March 29, 2017 at 7:13:28 AM UTC-4, Konrad Malawski wrote:

> In principle sure, though not on anyones roadmap nowadays.
> You could contribute such a thing or find a json parser whihc has such
> failure mode - I'm unaware of any parser which has such failure mode though.
>

Jackson has a failure mode to fail on unknown fields, and actually it's the
default.
You need to explicitly disable it if you don't want it. Either globally
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
or per class:
@JsonIgnoreProperties(ignoreUnknown = true)

It looks like there's some support for using jackson in akka-http:
http://doc.akka.io/docs/akka/2.4.6/java/http/common/json-support.html
so maybe that's one way to go.


On Wednesday, March 29, 2017 at 7:54:57 AM UTC-4, Alan Burlison wrote:
>
> On 29/03/2017 12:13, Konrad Malawski wrote:
>
> I can't think of any way of doing it that doesn't require reflection to
> enumerate the fields in the case class that the JSON is being
> unmarshalled in to. And although I've used Spray/JSON quite a bit I have
> no idea how the case class/tuple marshalling/unmarshalling stuff works.



Would it be possible to override the JsonReader and do something like:

def read(value: JsValue) = {
  val names = Set(fieldName1, fieldName2, fieldName3)
  value.asJsObject.fields.keys.filterNot(names.contains).foreach { field =>
 throw new UnknownFieldException(field)
  }
  val p1V = fromField[P1](value, fieldName1)
  val p2V = fromField[P2](value, fieldName2)
  val p3V = fromField[P3](value, fieldName3)
  construct(p1V, p2V, p3V)
}

It's using reflection but only once per case class.
If you need it for a lot of case classes you can probably generate some
code by using the template:
https://github.com/spray/spray-json/blob/master/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template

-
Henrik

-- 
>>>>>>>>>>  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 client - Advice for executor context

2017-04-25 Thread Konrad Malawski
Dispatcher (executor) is mostly important if you're doing bad things on it
- like blocking on responses for example.
If you're handling things in async / reactive ways the default akka
dispatcher is fine most of the time, just don't block on it (read this:
http://doc.akka.io/docs/akka-http/10.0.5/scala/http/handling-blocking-operations-in-akka-http-routes.html
same
thing applies in any code really).

It is more interesting to think about the connection pools configured than
the dispatcher here.
Those can limit how many connections you can have open to a given host,
what timeouts should be set for idle timeouts and cleaning up connections
etc. You can read about this in documentation on pools in akka http.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 26 April 2017 at 09:15:00, Albert Gorski (albgor...@gmail.com) wrote:

Hi,
I've Akka HTTP service which calls 5 other services using Akka HTTP client
(Host-Level Client-Side API). Currently I have executor context per service
(host/port).

What is the best practice for setting executor context? I mean, should I
use fork-join or cached or fixed thread pool or maybe something else?
Is it good to configure executor context pro service? It's a kind of
bulkhead solution, but is it really good for performance?

Thank you for response in advance:)

Cheers,
Albert

-- 
>> 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] Relative URL when using Http Request?

2017-04-24 Thread Konrad Malawski
Because the route test does not actually start a real server. That's a
feature. It allows testing all routes without involving actual parsing and
starting servers so it is much much faster than full integration testing.

If you want to bind a real server in your test simply do so same as in
normal apps.

Instead of doing requests to yourself I would recommend sharing code or
methods inside the implementation.

-- 
Konrad Malawski

On April 25, 2017 at 11:31:33, todd.f@gmail.com (todd.f@gmail.com)
wrote:

> Hi,
>
> I'm using akka-http to build a restful api. In one route of my app, the
> route need to access one of my other routes in the same app, like the
> following:
>
>
>- `/foo`, which access `/bar` and returns slightly modified content
>from the latter as response
>- `/bar`
>
> In the implementation of `/foo`, I used absolute path: `127.0.0.1:8080/bar`,
> and request by `Http().singleRequest(...)`. This works fine initially, but
> as I start to write the test cases with akka test kit(ScalatestRouteTest),
> the port 8080 seems cannot be accessed in my test:
>
> ```
> Get("/foo") ~> route ~> check {...}
> ```
>
> and it shows the error:
>
> ```
> akka.stream.StreamTcpException: Tcp command 
> [Connect(127.0.0.1:8080,None,List(),Some(10
> seconds),true)] failed
> ```
>
> Thus I'm looking for a way to make request to `/bar`, with relative URL,
> hoping it solve this problem. Any idea is appreciated.
>
> ---
> BR,
> Todd Leo
>
> --
> >>>>>>>>>> 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] Handling spray.json.DeserializationException in akka-http route

2017-04-24 Thread Konrad Malawski
Hi there,
Read the documentation about exception handlers in Akka http. That should
get you what you want

-- 
Konrad Malawski

On April 25, 2017 at 8:13:24, Andras Szerdahelyi (
andras.szerdahe...@gmail.com) wrote:

> ( I apologize for the re-post if you've seen this under the akka /
> akka-http tag at stackoverflow already )
> Hello list,
>
> I have a need to encode exception messages in to a specific JSON format in
> my http responses. I was wondering how I could catch a
> DeserializationException in my route or outside of it or encode the
> DeserializationException.
>
> I tried the following:
>
> 1) the below exception handler around my route:
>
> val exceptionHandler = ExceptionHandler {
> case e: DeserializationException => complete(StatusCodes.BadRequest,
> ServiceBrokerError(e.getMessage))
> }
> 2) JSON format in implicit scope for DeserializationException
>
> implicit object DeserializationExceptionFormat extends DefaultJsonProtocol
> with RootJsonFormat[DeserializationException] {
>
>   def write(e: DeserializationException) = JsObject("message" ->
> JsString(e.getMessage))
>   def read(v: JsValue) = throw new NotImplementedError()
>
> }
> Neither of these made any difference and DeserializationExceptions are
> still encoded in to the http response body per below:
>
> HTTP/1.1 400 Bad Request
> Content-Length: 74
> Content-Type: text/plain; charset=UTF-8
> Date: Thu, 20 Apr 2017 21:23:11 GMT
> Server: akka-http/10.0.1
>
> The request content was malformed:
> Node count may not be a floating number
>
> Some additional context- my routes rely on the spray-json integration to
> map request entities to objects, such as:
>
> // service instance management related routes
> put {
>   entity(as[CreateInstance]) { createInstance =>
> handleCreateInstance(s"cluster-$clusterId", createInstance) }
> }
>
> it is the DeserializationException that I throw from the Format
> implementation of CreateInstance that I would like to capture somewhere in
> or around my routes..
>
> Any suggestions are greatly appreciated.
>
>
> --
> >>>>>>>>>> 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] Lookup custom header in response headers

2017-04-24 Thread Konrad Malawski
Hi Kyrylo,
Would you mind sharing your code for the transaction id header?

That way of extracting a header does work, and I've added a test as we were
missing that specific style actually:
https://github.com/akka/akka-http/pull/1047

I suspect you may have done something wrong in your header definition - are
you sure you defined everything that's needed?


See this test for more usage examples:
https://github.com/akka/akka-http/blob/master/akka-http-tests/src/test/scala/akka/http/scaladsl/server/ModeledCustomHeaderSpec.scala


On Fri, Apr 21, 2017 at 4:23 PM, Kyrylo Stokoz  wrote:

> Hi All,
>
> I`m trying to extract custom header from response object like this:
>
> response.header[`X-Transaction-Id`]
>
>
> but it always give me None, changing it to lookup by name return expected 
> value.
>
>
> response.headers.find(_.lowercaseName() == 
> `X-Transaction-Id`.name.toLowerCase)
>
>
> It looks like it is related to modeling custom headers as RawHeader.
>
> According to 
> http://doc.akka.io/docs/akka-http/10.0.5/scala/http/common/http-model.html:
>
> "Thanks to extending ModeledCustomHeader instead of the plain CustomHeader 
> such header can be matched"
>
>
> Should it apply to header extraction in the way above as well? Is it a bug? 
> or as designed?
>
>
> Regards,
>
> Kyrylo
>
> --
> >> 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,
Konrad 'ktoso' Malawski
Akka  @ Typesafe 

-- 
>>  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 websocket server-push model (server sends messages to client)

2017-04-21 Thread Konrad Malawski
Hi Andy,
further details on how (where to which client) you want to push would be
helpful for my understanding (and future development).

We have developed an example app recently that does such a thing, it
registers "drones" in an actor that keeps track of them by ID, and allows
the server at-will to push commands to the drones into the websocket
connection such drone has opened.

It does a bit more so (handles resumption and clustering) it's more
complex, but you could have a look at it for now:
https://github.com/henrikengstrom/sa-2017-akka/blob/master/src/main/scala/org/h3nk3/saconf/backend/DroneConnectionHub.scala

It is in Scala but the code would be pretty much the same in Java.
I think this may point you in the direction you might want to take this.

Hope this helps

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 22 April 2017 at 02:15:32, Andrew Schenck (andrewsche...@gmail.com)
wrote:

Hello all,

I have scoured the questions raised here that are similar to my needs but
so far have not been successful at finding a solution.

I need (want) to be able to create an akka websocket server in which I can
send messages from the server to the clients connected (for example, send
the outputs from a flink analytic along the websocket to an end user GUI).
I was able to implement the request-response example, but so far have had
little success in a 'server push' model.

Using something like jetty it is as easy as ws.broadcast, but I understand
akka needs to use backpressure etc, soI guess what I am stumbling with is
how to create a proper flow in a 'server-push' model, in *java*.

If there are examples I can look at (haven't found any) or some literature
I can read or any suggestions as to how to create this 'server-push'
websocket model it would be greatly appreciated.

Thanks for the help,

Andy
--
>> 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] FileIO.toFile does not truncate existing file

2017-04-21 Thread Konrad Malawski
Great catch, you're absolutely right. Please open a PR, thanks!

-- 
Konrad Malawski

On April 21, 2017 at 22:39:28, Patrik Nordwall (patrik.nordw...@gmail.com)
wrote:

> Wow, not truncating would be very confusing. Please open a PR.
>
> On Fri, Apr 21, 2017 at 3:36 PM, Enno <enno.ru...@gmail.com> wrote:
>
>> Hi Hakkars,
>>
>> The file my stream created started to look rather funny so I had to dig a
>> bit.
>>
>> The API docs for FileIO.toFile state it "Overwrites existing files by
>> default.", but that becomes a bit to literally with the default options.
>> (see http://doc.akka.io/api/akka/2.5/akka/stream/scaladsl/FileIO$.html )
>>
>>   def toPath(f: Path, options: Set[StandardOpenOption] = Set(WRITE,
>> CREATE))
>>
>> For an existing file with options WRITE, CREATE the new content will
>> overwrite the file's content from the file's start, but not truncate the
>> old contents. So in case less content is written in later runs the old
>> content will follow the new content.
>>
>> Wouldn't it be more intuitive (and more according to the docs) to use
>> WRITE, CREATE, TRUNCATE_EXISTING as default options?
>> (see https://docs.oracle.com/javase/8/docs/api/java/nio/
>> file/StandardOpenOption.html )
>>
>> Cheers,
>> Enno.
>>
>> --
>> >>>>>>>>>> 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.
>>
>
>
>
> --
>
> Patrik Nordwall
> Akka Tech Lead
> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
>
> --
> >>>>>>>>>> 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] GraphStage instead of ActorPublisher/ActorSubscriber

2017-04-18 Thread Konrad Malawski
I would not call it a stub... it's basically all you need.
I see however that you're asking for extend documentation with examples in
that section - would you mind opening a ticket on
http://github.com/akka/akka about that (Add more examples for integrating
with Actors in docs section ...)?

Thanks in advance for the ticket :)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 19 April 2017 at 12:46:23, Richard Rodseth (rrods...@gmail.com) wrote:

I've read that ActorPublisher and ActorSubscriber are deprecated in favour
of GraphStage, but haven't found examples of how to accomplish this. This
section of the documentation is a stub:

http://doc.akka.io/docs/akka/2.5/scala/stream/stream-customize.html#Integration_with_actors

I have several scenarios where I need to thread a stream through an actor,
but still want to take advantage of backpressure.

So far I'm using mapAsync() and ask()


--
>> 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: Has akka-http has abandoned per request actors in favor an anti-pattern DSL?

2017-04-18 Thread Konrad Malawski
For starters: It's fine if your preference is to not use the DSL, no one
will force you to; and that's also the reason the DSL is a separate
artifact.

Also, your route here is definitely multiple things and those should be
split up.
Why make one huge route, make many vals with the small pieces (e.g. all the
path prefixed parts in a real app would be in different traits in single
vars) and then simply combine them.

If your specific complaint is about the missing ~, that's solved in two
ways:
*1) just don't use ~. Use concat :-)*

concat(
  get {
complete("ok")
  },
  path("hello") {
complete("ok")
  }
)


2) JetBrains is actively working on adding Akka support, all across the
board, including routes and other things in plain actors etc.
One of the issues I opened and is being worked on right now is the ~
problem: https://youtrack.jetbrains.com/issue/SCL-11632


-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 19 April 2017 at 12:48:21, kraythe (kray...@gmail.com) wrote:

Sorry, I have been buried with work.

The problem with the DSL approach in my opinion is that it leaves too much
space for error and strange things happening and at the same time it
hamstrings you into a particular flow that may or may not be appropriate to
the problem. Just to have some fun, this route doesn't work. It compiles
just fine, the server comes up but nothing happens. Spot the problem?

val route = {
  path("orders") {
authenticateBasic(realm = "admin area", myAuthenticator) { user =>
  get {
encodeResponseWith(Deflate) {
  complete {
// marshal custom object with in-scope marshaller
retrieveOrdersFromDB
  }
}
  } ~
  post {
// decompress gzipped or deflated requests if required
decodeRequest {
  // unmarshal with in-scope unmarshaller
  entity(as[Order]) { order =>
complete {
  // ... write order to DB
  "Order received"
}
  }
}
  }
}
  } ~
  // extract URI path element as Int
  pathPrefix("order" / IntNumber) { orderId =>
pathEnd {
  (put | parameter('method ! "put")) {
// form extraction from multipart or www-url-encoded forms
formFields(('email, 'total.as[Money])).as(Order) { order =>
  complete {
// complete with serialized Future result
(myDbActor ? Update(order)).mapTo[TransactionResult]
  }
}
  } ~
  get {
// debugging helper
logRequest("GET-ORDER") {
  // use in-scope marshaller to create completer function
  completeWith(instanceOf[Order]) { completer =>
// custom
processOrderRequest(orderId, completer)
  }
}
  }
}
path("items") {
  get {
// parameters to case class extraction
parameters(('size.as[Int], 'color ?, 'dangerous ? "no"))
  .as(OrderItem) { orderItem =>
// ... route using case class instance created from
// required and optional query parameters
complete("") // hide
  }
  }
}
  } ~
  pathPrefix("documentation") {
// optionally compresses the response with Gzip or Deflate
// if the client accepts compressed responses
encodeResponse {
  // serve up static content from a JAR resource
  getFromResourceDirectory("docs")
}
  } ~
  path("oldApi" / Remaining) { pathRest =>
redirect("http://oldapi.example.com/; + pathRest, MovedPermanently)
  }}


If you got that there is one missing ~ between the routes you have a sharp
eye but the DSL wont tell you, the code compiles just fine. But there I
thought the DSL was supposed to make everything easy. Nope, if you put
directives in the wrong order, nest them in the wrong order, or anything
like that the code doesnt warn you, it just refuses to run. Yes, you can
scream "unit test everything" but really? Is this untyped Ruby here?
Testing everything is not a strategy that scales well in business or
endures in a long running codebase, its an academic construct that
eventually crumbles under the real world.

The other problem with the routing is that it ties you into a certain set
of directives and techs and breaking out of that is painful. Lets say you
like the validation checking of Play-json over Spray-json? Can it be
integrated with the route? With difficulty maybe but then you dont get the
ability to handle errors like you do with the low level API. If the body
doesnt parse out to the type the route blows up and the user gets back an
internal error. What if I dont want to tell my users how to hack json to
feed to my site? What if I dont want actors blowing up on internal errors?
If so then I am up a creek of thin ice.

Subsequent to my OP, I sat down and worked with the DSL for a good week,
integrating it into the business 

Re: [akka-user] GraphStage instead of ActorPublisher/ActorSubscriber

2017-04-18 Thread Konrad Malawski
Implement the logic within the GraphStage.
It basically behaves like an Actor (but can be fused too).

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 19 April 2017 at 12:46:23, Richard Rodseth (rrods...@gmail.com) wrote:

I've read that ActorPublisher and ActorSubscriber are deprecated in favour
of GraphStage, but haven't found examples of how to accomplish this. This
section of the documentation is a stub:

http://doc.akka.io/docs/akka/2.5/scala/stream/stream-customize.html#Integration_with_actors

I have several scenarios where I need to thread a stream through an actor,
but still want to take advantage of backpressure.

So far I'm using mapAsync() and ask()


--
>> 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] Shutting down a ShardRegion

2017-04-17 Thread Konrad Malawski
What you describe is exactly a feature we just rolled out in Akka 2.5.0 :-)
Docs here:
http://doc.akka.io/docs/akka/2.5/scala/actors.html#Coordinated_Shutdown
It also handles other parts of Akka, such as cluster singletons, Akka HTTP
and more.

Akka 2.5 is binary compatible with 2.4 (except if a library touched some
specific internals / private APIs - see the release notes for details),
so you should be able to quickly hop onto it :-)

Happy hakking!

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 18 April 2017 at 14:31:24, Arno Haase (arno.ha...@haase-consulting.com)
wrote:

When shutting down an ActorSystem, I would like to shut down a
ShardRegion in three phases to ensure consistency:

1. Prevent sharded entities from receiving any new commands
2. Let the sharded entities finish their work
3. Actually shut down the ShardRegion, stopping all sharded entities and
allowing other shards to start this shard's entities

To give some context, in my case command processing involves some
interaction between sharded entities and other actors (e.g. updating an
ElasticSearch index), so step 2 involves more than just stopping the
sharded entity actor.

This looks like a common problem, but I found no API for doing step 1
without stopping sharded entity actors. In particular, sending
GracefulShutdown to the ShardRegion appears to do 1. and 3. without
allowing the application code to do 2.

Am I missing something? Any help is appreciated.

- Arno


-- 
>> 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] akka-http and jackson marshaller/unmarshaller

2017-04-16 Thread Konrad Malawski
Why are you mixing javadsl with scaladsl. Javadsl is clearly not intended
for Scala users :-)

Just use https://github.com/hseeberger/akka-http-json which provides
jackson as one of the impls.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 17 April 2017 at 12:12:43, Eugene Dzhurinsky (jdeve...@gmail.com) wrote:

I have a very basic setup:

import akka.http.javadsl.marshallers.jackson.Jackson._
import akka.http.scaladsl.marshalling.ToResponseMarshaller
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.unmarshalling._


/**
  * HTTP service definitions.
  */
object Http {

  val DocMarshaller = marshaller[MyDocument]()
  val DocUnMarshaller = unmarshaller(classOf[MyDocument])

  implicit val um: FromRequestUnmarshaller[MyDocument] = ???
  implicit val m: ToResponseMarshaller[MyDocument] = ???

  trait Calculator {

def prefix: String

val calculate = ((path(prefix / "method" / "doc") & pathEnd) &
post & entity(as[MyDocument])) {
  doc ⇒ complete(doc)
}

  }

}


What is the best way to implement the marshaller/unmarshaller in terms of
Jackson marshaller/unmarshaller, without reimplementing the entire
Unmarshaller for the objects? Some combinators I'm not aware of?

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.

-- 
>>  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 streams: Why use .named()?

2017-04-12 Thread Konrad Malawski
Not sure what you're referring to?
Yes it does/would come into play when we draw stuff.

On Apr 13, 2017 03:07, "Sean Callahan"  wrote:

> Okay, that's kinda what I figured. Will the named attribute come into play
> at all with some of the graphing Ive seen a little of in 2.5?
>
> --
> >> 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] Akka streams: Why use .named()?

2017-04-12 Thread Konrad Malawski
Better debugability - names can show up in logging / failures / inspections
of graphs etc.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 13 April 2017 at 02:59:49, Sean Callahan (sean.callahan...@gmail.com)
wrote:

While browsing the akka docs I came across heavy use of the .named method
in http://doc.akka.io/docs/akka/2.4.17/scala/stream/stream-composition.html


In the docs, it is mentioned that this creates nested sources/flows/sinks,
but Im not quite sure what this provides me exactly. Im guessing that I
should be using it more in some of my complex graphs, but Im not.

For example if I have two identical flows, what does a named flow buy me
over an unnamed one?
--
>> 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] TcpIdleTimeoutException for Http request

2017-04-11 Thread Konrad Malawski
Well it seems no data is flowing on the connection "the request".
Please provide sample code; I think you may be misunderstanding the
lifecycle of a connection a bit?

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 12 April 2017 at 13:08:55, Johnson Liu (coolsuntrave...@gmail.com) wrote:

Hi Konrad. Yes, a connection has been idle for too long, but why do I hit
this exception when I am sending a request? I thought the connection pool
would establish a new connection once an old connection times out and pick
a valid connection for me when I am sending a request. Should I catch this
exception and request again? 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.

-- 
>>  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] TcpIdleTimeoutException for Http request

2017-04-11 Thread Konrad Malawski
Hi there,
timeouts are documented in depth here:
http://doc.akka.io/docs/akka-http/10.0.5/scala/http/common/timeouts.html

Basically idle timeouts means a connection is hanging around doing nothing
- no data being sent either way,
so it should be torn down - we signal this via this timeout.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 11 April 2017 at 10:02:33, Johnson Liu (coolsuntrave...@gmail.com) wrote:

Hi, I am making requests through a cachedHostConnectionPool, very similar
to the example given in host level api in the documentation. Sometimes I
get akka.stream.scaladsl.TcpIdleTimeoutException. Does it mean the request
is unsuccessful because all available connections are timed out?
--
>> 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] [Akka-Http] Consuming request entity multiple times

2017-04-10 Thread Konrad Malawski
The reason it worked for the small payload is an optimisation done by Akka
http, if it detects the entity will be a small "strict" one, the entire
thing is loaded. So such payload can be materialized twice.

We hope to make this more configurable in the future, and help with those
scenarios even more. Hope this helps.



On Apr 11, 2017 00:06, "Mushtaq Ahmed"  wrote:

> Ok, my test data was very small. If I increase the content of the uploaded
> data I do see the exception of multiple materialization.
>
> Thanks.
>
>
> On Mon, Apr 10, 2017 at 7:18 PM, Mushtaq Ahmed 
> wrote:
>
>> Hello!
>>
>> I am uploading a file using fileUpload directive to an akka-http server.
>> On server side once I get handle to the streaming request entity, I am able
>> to successfully materialize the stream *multiple* times. How is it
>> possible? Where does the data for the second materialization come from?
>>
>> On the other hand, akka-http client connected to the same server does
>> throws exception if I materialize the response entity more than once, which
>> is expected.
>>
>> Thanks.
>>
>> --
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: http://doc.akka.io/docs/akka/c
>> urrent/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/to
>> pic/akka-user/PlMgcFxFb5Y/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.
>

-- 
>>  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: WebSocket with Akka Streams

2017-04-01 Thread Konrad Malawski
Correct this works to append to files.
Please note that if multiple threads (incoming streams) write to the same
file appending you could get messy data out of that tough.

On Apr 1, 2017 12:28, "Julian Howarth" <10.howa...@gmail.com> wrote:

> You can get the Sink to append to file by passing in different options
> (again untested):
>
> import java.nio.file.StandardOpenOption._
> FileIO.toFile(new File(filename), Set(WRITE, APPEND))
>
> On Saturday, April 1, 2017 at 11:24:10 AM UTC+1, Julian Howarth wrote:
>>
>> Each incoming websocket request materializes a new Flow. For each item
>> within each of those Flows you create and run a new Flow (i.e. the dump
>> method). That Flow then ends up in the sink created by FileIO.toFile.
>> Reading the documentation for that method: "Overwrites existing files by
>> default", so each message sent via WS will create the files anew each time.
>>
>> You need to create your flow such that it is continuous, i.e. items flow
>> all the way down to the sinks in a single flow. Rather than dump within the
>> collect, you can branch off the flow using alsoTo - something like
>> (untested):
>>
>> Flow[Message].collect {
>> case TextMessage.Strict(text) => (text, longToIP(id))
>>   }
>>   .alsoTo(fileSink)
>>   .map(pair => TextMessage(s"I got your message: ${pair._1}!")
>>
>> Then fileSink looks like:
>>
>> val fileSink =
>>   Flow[(String, String)]
>> .map(s => ByteString(s + "\n")) // do something to extract the data
>> you want here
>> .to(FileIO.toFile(new File(filename)))
>>
>> You can add in additional steps to write to other files, either using the
>> builder DSL as you did, or using alsoTo again.
>>
>> This gets around the issue for multiple messages on one WS connection,
>> but a second WS connection will again overwrite the file. Two solutions
>> that spring to mind for that:
>>
>> 1. Use a sink that appends rather than overwrites the file (though note
>> that depending on volume of requests you could well end up with contention
>> on the file)
>> 2. Use a MergeHub to route the requests from the websockets into a single
>> Flow which then writes to the files.
>>
>> Julian
>>
>>
>> On Saturday, April 1, 2017 at 8:39:43 AM UTC+1, Madabhattula Rajesh Kumar
>> wrote:
>>>
>>> Hi,
>>>
>>> I need to read messages from clients(web socket clients) and persist
>>> these messages into two files. But, messages are overriding to previous
>>> messages. Every time only last message is present in the file.
>>>
>>> How to append the messages. Please help me to resolve this issue.
>>>
>>> *Code :- *
>>>
>>>  def route(implicit actorSystem: ActorSystem, materializer:
>>> Materializer): Route =
>>> pathPrefix("ssys" / LongNumber) { id =>
>>>   parameter('name) { name ⇒
>>> handleWebSocketMessages(broadcast(id, name))
>>>   }
>>> }
>>>   def broadcast(id: Long, name: String): Flow[Message, Message, Any] = {
>>> Flow[Message].collect {
>>>   case TextMessage.Strict(text) =>
>>>  dump(text, longToIP(id))
>>> TextMessage(s"I got your message: $text!")
>>> }
>>>   }
>>>
>>>def dump(text: String, id: String ) {
>>>  val value1 = Source.single(text, id)
>>>  val sink1 = lineSink("/Users/log/data/test1.txt")
>>> val sink2 = lineSink("/Users/log/data/test2.txt")
>>> val g = RunnableGraph.fromGraph(GraphDSL.create() { implicit b =>
>>>   import GraphDSL.Implicits._
>>>   val bcast = b.add(Broadcast[String](2))
>>>   value1.map(x => x) ~> bcast.in
>>>   bcast.out(0) ~> sink1
>>>   bcast.out(1) ~> sink2
>>>   ClosedShape
>>> })
>>> g.run()
>>>
>>>   }
>>>
>>> def longToIP(long: Long): String = {
>>> (0 until 4).map(a => long / math.pow(256, a).floor.toInt %
>>> 256).reverse.mkString(".")
>>>   }
>>>
>>>   def lineSink(filename: String): Sink[String, Future[IOResult]] = {
>>> Flow[String]
>>>   .map(s => ByteString(s + "\n"))
>>>   .toMat(FileIO.toFile(new File(filename)))(Keep.right)
>>>   }
>>>
>>> Regards,
>>> Rajesh
>>>
>> --
> >> 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 

Re: [akka-user] Catching exceptions in actor receive?

2017-04-01 Thread Konrad Malawski
Read about supervision, one of the strategies is Resume.

Try/catch is also fine, but mostly if you want to do stuff with the
exception other than log it. E.g. Reply that things failed.

On Apr 1, 2017 07:58, "kraythe"  wrote:

> I have an actor that I would like to not fail. However there is a
> possibility that a user might call the actor with some problem that results
> in an exception not being thrown. The proscribed way to handle this is to
> fial the actor and have the supervisor restart the actor, however that is
> not a good idea. When this actor starts it loads a ton of data, sometimes
> in the hundreds of megs and holds that data to serve content to the users
> and handle updating the data for users to see. You can think of this actor
> as a large cache. Breaking up the actor is not an option because the data
> has to be cohesive. What I would rather not happen is have the actor be
> restarted at any time unless there is something drastically gone wrong. So
> what do you recommend to do this? I could enclose the recieve in a
> try-catch (indeed that is what i do now) and deal with the exceptions in
> that matter. Is there some other strategy I am missing?
>
> Thanks in advance.
>
> --
> >> 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] Can Akka Actors be considered as green threads?

2017-03-31 Thread Konrad Malawski
Actors are objects that are scheduled on Kernel threads using ForkJoin Pool?

That's how they're implemented yeah - tasks submitted to a pool.

But that misses all the things which make the model useful: isolation and
location transparency (the most important one!).

So you don't care if an actor is on the same node or not, API does not
change, and "fits" as it's messaging and not RPC style which hides the fact
that things are remote.
-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 


On 31 March 2017 at 12:53:32, kant kodali (kanth...@gmail.com) wrote:

-- 
>>  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] SOF question on debugging, breakpoints, timout and dead letters

2017-03-31 Thread Konrad Malawski
Sure, it is the community - so please be nice to it :-)
It is not nice to go over all possible channels just sending links to stack
overflow.

At least re state your question or that you did not get an answer there etc.
Asking for help works better if you're nice about it.

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 31 March 2017 at 11:44:50, Jozsef Hegedus (jhegedu...@gmail.com) wrote:

Thanks for the info.

I don't really know what is the connection between Akka and Lightbend.

I was thinking this is a community Akka channel and not a commercial
channel for advertising Lightbend, or is it ?

On Fri, Mar 31, 2017 at 12:40 PM, Konrad Malawski <
konrad.malaw...@lightbend.com> wrote:

> Hi Jozsef, when cross-posting at least take the effort to copy the
> message...
> Just posting more links via more channels seems very "nagging".
>
> If you want ASAP answers we offer commercial support, otherwise please be
> nice and patient when asking the community for help.
> Thanks for your understanding.
>
> --
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 30 March 2017 at 22:52:38, Jozsef Hegedus (jhegedu...@gmail.com) wrote:
>
> Why do I get dead letters when trying to debug akka actor using a
> breakpoint?
>
> http://stackoverflow.com/questions/43127370/why-do-i-
> get-dead-letters-when-trying-to-debug-akka-actor-using-a-breakpoint
>
>
> --
> >>>>>>>>>> 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] SOF question on debugging, breakpoints, timout and dead letters

2017-03-31 Thread Konrad Malawski
Hi Jozsef, when cross-posting at least take the effort to copy the
message...
Just posting more links via more channels seems very "nagging".

If you want ASAP answers we offer commercial support, otherwise please be
nice and patient when asking the community for help.
Thanks for your understanding.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 30 March 2017 at 22:52:38, Jozsef Hegedus (jhegedu...@gmail.com) wrote:

Why do I get dead letters when trying to debug akka actor using a
breakpoint?

http://stackoverflow.com/questions/43127370/why-do-i-get-dead-letters-when-trying-to-debug-akka-actor-using-a-breakpoint


--
>> 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] Need a simple example on how to consume a HTTP Service with Json unmarshalling

2017-03-30 Thread Konrad Malawski
Glad you worked it out :)
We're working on improving the docs a lot in the very near future, hope
that'll help newcomers.

Happy hakking!

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 30 March 2017 at 16:57:56, Mo Batista (mounir3...@gmail.com) wrote:


package xxx

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import akka.http.scaladsl.model._
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.stream.{ActorMaterializer, Materializer}
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.{BeforeAndAfter, FlatSpec, MustMatchers}
import org.scalatest.mock.MockitoSugar
import spray.json.DefaultJsonProtocol
import scala.concurrent.{Await, ExecutionContextExecutor, Future}
import akka.http.scaladsl.server.Directives

case class ColorBlob(url: String, averageColor: String,
classificationColor: String)
case class ColorBlobsResponse(colorBlobs: Map[String, Option[ColorBlob]])

trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol {
  implicit val format1 = jsonFormat3(ColorBlob)
  implicit val format2 = jsonFormat1(ColorBlobsResponse) // this
already provided all the needed marshallers
}

class ColorBlobRestTest
  extends FlatSpec
with MockitoSugar
with BeforeAndAfter
with MustMatchers
with ScalaFutures
with JsonSupport
with Directives {

  implicit val system: ActorSystem = ActorSystem()
  implicit val executor: ExecutionContextExecutor = system.dispatcher
  implicit val materializer: Materializer = ActorMaterializer()

  "this" should "work" in {
val request = HttpRequest(method = HttpMethods.GET, uri =
s"https://colorblobs.svc.dglecom.net/ws/colorblobs/de?productCodes=904655;)
val futureResponse: Future[HttpResponse] = Http().singleRequest(request)

val futureColorBlobResponse: Future[ColorBlobsResponse] =
futureResponse.flatMap { response: HttpResponse =>
  val entity: ResponseEntity = response.entity
  Unmarshal(entity).to[ColorBlobsResponse]
}

import scala.concurrent.duration._
val colorBlobsResponse: ColorBlobsResponse =
Await.result(futureColorBlobResponse, 1000.millis)

assert(1==1)

  }
}





Hi Konrad

yes it does !

Here is my working example. I dumbed it down for future reference, if
anyone is interested. The solution is indeed much easier than I thought!
Thanks again for your help! Yeah, I know the documentation is there, but
everything is a little bit hard to follow.

have a good one! :)





Am Donnerstag, 30. März 2017 14:37:52 UTC+2 schrieb Konrad Malawski:
>
>
> On 30 March 2017 at 14:28:34, Mo Batista (mouni...@gmail.com) wrote:
>
> I'm new to Akka-Http please bear with me.
>
> Hello Mo and welcome to Akka :-
>
>
> What I'm trying to do is
>
> 1. Connect to a Restful service
> 2. Unmarshall the json payload into the following case class structure
>
> It's as simple as these docs really: http://doc.akka.io/
> docs/akka-http/10.0.5/scala/http/common/unmarshalling.
> html#using-unmarshallers
>
> So you just need:
>
> implicit val colorBlobsFormat = jsonFormat1(ColorBlobsResponse) // this 
> already provided all the needed marshallers
>
> // implicit materializer in Scope AFAIR too
>
> import system.dispatcher
>
> Unmarshal(entity).to[ColorBlob]
>
>
> In theory this should be simple, but it turns out that anything on this
> topic is either outdated or way over my head, as in this article
> http://malaw.ski/2016/04/10/hakk-the-planet-implementing-
> akka-http-marshallers/
>
> That's about writing custom unmarshallers which is rather advanced - you
> don't need to do that.
>
> http://doc.akka.io/docs/akka-http/10.0.1/scala/http/common/
> unmarshalling.html doesn't explain how to actually write an unmarshaller
>
>
>
>
> This is where I got so far:
>
> Issuing the request
>
> val request = HttpRequest(method = HttpMethods.GET, uri = 
> s"https://colorblobs.service.net/ws/colorblobs/en?productCodes=904655;)
>
> val future = Http().singleRequest(request)
> val result: ColorBlobsResponse = 
> Await.result(future.flatMap(Unmarshal(_).to[ColorBlobsResponse]), 
> Duration.Inf)
>
>
>
>
> Small note here, I would strongly recommend never using Duration.Inf, even
> in sample code as you might get used to it and in general it simply is a
> very bad idea to block infinitely.
> Put `import scala.concurrent.duration._` and `2.seconds` instead for
> example.
>
> Providing the  unmarshaller. This is also where I got stuck
>
> You don't need to do any of the manual Unmarshaller building, it's all
> ready once you did the jsonFormat call :)
>
>
> Now that I have ResponseEntity what would be the next step?
>
> No need

Re: [akka-user] Need a simple example on how to consume a HTTP Service with Json unmarshalling

2017-03-30 Thread Konrad Malawski
On 30 March 2017 at 14:28:34, Mo Batista (mounir3...@gmail.com) wrote:

I'm new to Akka-Http please bear with me.

Hello Mo and welcome to Akka :-


What I'm trying to do is

1. Connect to a Restful service
2. Unmarshall the json payload into the following case class structure

It's as simple as these docs really:
http://doc.akka.io/docs/akka-http/10.0.5/scala/http/common/unmarshalling.html#using-unmarshallers

So you just need:

implicit val colorBlobsFormat = jsonFormat1(ColorBlobsResponse) //
this already provided all the needed marshallers

// implicit materializer in Scope AFAIR too

import system.dispatcher

Unmarshal(entity).to[ColorBlob]


In theory this should be simple, but it turns out that anything on this
topic is either outdated or way over my head, as in this article
http://malaw.ski/2016/04/10/hakk-the-planet-implementing-akka-http-marshallers/

That's about writing custom unmarshallers which is rather advanced - you
don't need to do that.

http://doc.akka.io/docs/akka-http/10.0.1/scala/http/common/unmarshalling.html
doesn't explain how to actually write an unmarshaller




This is where I got so far:

Issuing the request

val request = HttpRequest(method = HttpMethods.GET, uri =
s"https://colorblobs.service.net/ws/colorblobs/en?productCodes=904655;)

val future = Http().singleRequest(request)
val result: ColorBlobsResponse =
Await.result(future.flatMap(Unmarshal(_).to[ColorBlobsResponse]),
Duration.Inf)




Small note here, I would strongly recommend never using Duration.Inf, even
in sample code as you might get used to it and in general it simply is a
very bad idea to block infinitely.
Put `import scala.concurrent.duration._` and `2.seconds` instead for
example.

Providing the  unmarshaller. This is also where I got stuck

You don't need to do any of the manual Unmarshaller building, it's all
ready once you did the jsonFormat call :)


Now that I have ResponseEntity what would be the next step?

No need to go so "manual" :-) Check the docs above.


Maybe there is a blog article explaining what  jsonFormat1,
DefaultJsonProtocol and FromResponseUnmarshaller actually do?

Again, the docs:

*http://doc.akka.io/docs/akka-http/10.0.5/scala/http/common/json-support.html#json-support

*

http://doc.akka.io/docs/akka-http/10.0.5/scala/http/common/marshalling.html#http-marshalling-scala


http://doc.akka.io/docs/akka-http/10.0.5/scala/http/common/unmarshalling.html#http-unmarshalling-scala





 I'm using akka-http 10.0.5 btw.

Thanks for providing that info, people often forget to and it helps a lot
to know that you're on the latest :)


Hope this helps,

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

-- 
>>  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/JSON: Rejecting requests with unknown fields

2017-03-29 Thread Konrad Malawski
In principle sure, though not on anyones roadmap nowadays.
You could contribute such a thing or find a json parser whihc has such
failure mode - I'm unaware of any parser which has such failure mode though.

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 28 March 2017 at 23:57:05, Alan Burlison (alan.burli...@gmail.com) wrote:

On 28/03/2017 22:51, Konrad Malawski wrote:

> Your unmarshaller (you did not say what you're using), should be
configured
> to blow up then.

The default Akka/HTTP one, namely Spray/JSON.

> The spray-json one can not do that.

That's unfortunate :-(

Is it possible in principle to extend it to reject unrecognised fields,
or is it a case of having to switch to a different framework? I'm also
using Spray/JSON to implement Akka persistence and I don't want to have
2 JSOn frameworks in the same app, so switching to another JSON
framework would not be trivial.

Thanks,

-- 
Alan Burlison
--

-- 
>>>>>>>>>>  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/JSON: Rejecting requests with unknown fields

2017-03-28 Thread Konrad Malawski
Your unmarshaller (you did not say what you're using), should be configured
to blow up then.
The spray-json one can not do that.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 28 March 2017 at 23:37:57, Alan Burlison (alan.burli...@gmail.com) wrote:

I'm using Akka's HTTP/JSON support to unmarshall JSON to case clasess
using the standard "entity" and "as" mechanism. It works fine but if I
supply JSON fields that don't have any corresponding case class fields
they are silently ignored whereas I need the request to be rejected. I
can't find any obvious way of doing this, is there one?

Thanks,

-- 
Alan Burlison
-- 

-- 
>> 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] Akka Stream- How to use Slick as Subscriber(Sink) to data into Database.

2017-03-28 Thread Konrad Malawski
AFAIR they have not implemented streaming inserts.

Just data.mapAsync()(insert).



-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 28 March 2017 at 10:19:50, DEEPAK GUPTA (vnitdee...@gmail.com) wrote:

Akka Stream- How to use Slick as Subscriber(Sink) to data into Database.
Example will help a lot
--
>> 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] Can we use activator for Spark projects?

2017-03-27 Thread Konrad Malawski
Just use SBT then ;-)
Yeah it's here to stay.

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 27 March 2017 at 15:41:15, kant kodali (kanth...@gmail.com) wrote:

Hi,

I don't mean to say that I want to use activator for the UI part. In fact,
I barely even use activator ui (although its really cool). I am at very
least using activator as a production build tool for apps that are written
using Play framework. is that ok? I like fact that activator makes the
packaging so easy either it is a zip, rpm debian or whatever and it puts
the configs at the appropriates places and so on.

I know that you mentioned activator is going to go away. How about SBT? is
that there to stay?

Thanks!

On Mon, Mar 27, 2017 at 3:48 AM, Konrad Malawski <
konrad.malaw...@lightbend.com> wrote:

> Activator is just a sample-app tool to try out Scala and tutorials etc.
> I guess it could maybe work with Spark for a demo but I would not
> recommend it...
>
> Use a real IDE :)
>
> --
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 27 March 2017 at 12:46:17, kant kodali (kanth...@gmail.com) wrote:
>
> Hi All,
>
> Can we use activator for Spark projects along with typesafe config
> library? Any examples?
>
> 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.
>
>
--
>>>>>>>>>> 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] Can we use activator for Spark projects?

2017-03-27 Thread Konrad Malawski
Activator is just a sample-app tool to try out Scala and tutorials etc.
I guess it could maybe work with Spark for a demo but I would not recommend
it...

Use a real IDE :)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 27 March 2017 at 12:46:17, kant kodali (kanth...@gmail.com) wrote:

Hi All,

Can we use activator for Spark projects along with typesafe config library?
Any examples?

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.

-- 
>>  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] How to avoid saturation in Akka HTTP (latency spikes)?

2017-03-25 Thread Konrad Malawski
That's one way, yeah - slick provides a nice non blocking API and handles
the blocking internally.
The other way is to isolate the blocking in actors thanks to configuring
custom dedicated threadpool based dispatchers - that's what we show in the
docs.

Again, sorry for no link, no fun to look for it a on a phone at friends
place :)

-- 
Konrad Malawski

On 25 March 2017 at 23:52:06, Manuel Darcemont (manuel.darcem...@gmail.com)
wrote:

> Ok, that's what I thought, I only wanted to be sure about it. So I guess
> integrating Slick 3 to benefit from it's non-blocking API would be a good
> first step.
>
> Thank you !
>
> 2017-03-25 23:25 GMT+01:00 Konrad Malawski <konrad.malaw...@lightbend.com>
> :
>
>> Avoiding blocking (or dealing with it if you have to) in Akka is well
>> documented,
>> Please google for "akka http blocking" and you'll get to the right part
>> of the docs.
>> We also have docs search which will get you to the same, right docs.
>>
>> Not near a laptop to get you the link, please find it using that above
>> query.
>>
>> --
>> Konrad Malawski
>>
>> On 25 March 2017 at 22:31:48, Manuel (manuel.darcem...@gmail.com) wrote:
>>
>>> up vote
>>> down votefavorite
>>> <http://stackoverflow.com/questions/43022174/how-to-avoid-saturation-in-akka-http-latency-spikes#>
>>>
>>> I have a akka-http (Scala) API server that serves data to a NodeJS
>>> server. In moments after startup, everything works fine, everything is
>>> fast. Latency is low. But suddenly, latency increases fastly. The API no
>>> longer responds, and the website becomes unusable.
>>>
>>> [image: enter image description here]
>>> <https://i.stack.imgur.com/uoy6o.png>
>>>
>>> The strange thing is that the traffic and the requests count remain
>>> stable. Latency spikes seem decorrelated from them.
>>>
>>> I guess this saturation is achieved with the blocking of all the threads
>>> in akka thread pool. Unfortunately, my Akka dispatcher is blocking, because
>>> I'm doing a lot of SQL queries (in MySQL) and because I'm not using a
>>> reactive library. I'm using Slick 2, which is, contrary to Slick 3,
>>> blocking-only.
>>>
>>> So, my question is, how to avoid this sort of bottling ? How to keep a
>>> latency proportional with the traffic ? Is there a way to evict the
>>> requests that cause the saturation in order to prevent them to compromise
>>> everything ?
>>>
>>> Thank you !
>>>
>>> --
>>> >>>>>>>>>> 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] Does Event Bus require Publisher and Subscriber to be started in certain order?

2017-03-24 Thread Konrad Malawski
There is not. EventStreams do not buffer.
You can just build such a thing yourself using Actors if you need to
though, it's pretty simple - one actor that gets/buffers/relays messages -
done.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 23 March 2017 at 22:49:03, kant kodali (kanth...@gmail.com) wrote:

Hi All,

Does Event Bus require Publisher and Subscriber to be started in certain
order? Isn't there a Listener which will push messages to subscribers
whenever they become alive?

I am playing with the LookUpBus Example from here
 but it doesn't
quite work for me.  here is my sample code and I had also commented on the
respective lines.

For now, I am just using print statements to debug. since the messages are
getting printed out I wonder if Publisher and Subscriber to be started in
certain order?

Thanks!


public class EventBusManager {

private static final LookupBusImpl LOOKUP_BUS = new LookupBusImpl();

public static LookupBusImpl getEventBus() {
return LOOKUP_BUS;
}
}


public class UserActor extends UntypedActor {

private final ActorRef out;
private final String topic;

public UserActor(ActorRef out, String topic) {
this.out = out;
this.topic = topic;
}

public static Props props(ActorRef out, String topic) {
return Props.create(UserActor.class, out, topic);
}

public void preStart() {
EventBusManager.getEventBus().subscribe(self(), topic); //
This Actor will become the subscriber of even bus so whenever
publisher sends a message I

   // Expect This
Actor to receive the messages

}

public void postStop() {
EventBusManager.getEventBus().unsubscribe(self());
}

public void onReceive(Object message) throws Exception {

System.out.println("Received Message: " + message); // I expect the
messages to be printed here
if (message instanceof String) {
out.tell(message, self());
}
}


}



public class LookupBusImpl extends LookupEventBus {

// is used for extracting the classifier from the incoming events
@Override
public String classify(MsgEnvelope event) {
return event.topic;
}

// will be invoked for each event for all subscribers which
registered themselves
// for the event’s classifier
@Override
public void publish(MsgEnvelope event, ActorRef subscriber) {
System.out.println("LOOKUP_BUS_IMPL: " + event.payload);
subscriber.tell(event.payload, ActorRef.noSender()); // not
sure what exactly is going on here? But I Expect the above actor to
receive the messages
}

// must define a full order over the subscribers, expressed as expected from
// `java.lang.Comparable.compare`
@Override
public int compareSubscribers(ActorRef a, ActorRef b) {
return a.compareTo(b);
}

// determines the initial size of the index data structure
// used internally (i.e. the expected number of different classifiers)
@Override
public int mapSize() {
return 128;
}



}


public class Application extends Controller {

public WebSocket handleWebSocketConnection() {
return WebSocket.withActor(new F.Function() {
@Override
public Props apply(ActorRef actorRef) throws Throwable {
return UserActor.props(actorRef, "hello");
}
});
}

}

public class Global extends GlobalSettings {


@Override
public void onStart(Application application) {

Logger.info("Brodcasted to event Bus started.."); // This prints out
to console fine

EventBusManager.getEventBus().publish(new MsgEnvelope("hello", "Hello
World")); // This is where I am publishing messages to event bus.
Logger.info("Brodcasted to event Bus completed"); // This
prints out to console fine

}


}

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

Re: [akka-user] Cannot use a method returning play.mvc.WebSocket[?0] as a Handler for requests

2017-03-23 Thread Konrad Malawski
That's a Play question, so please ask in the Play community:
https://groups.google.com/forum/#!forum/play-framework

This forum is called Akka-user, so yeah, we talk about Akka specifically
here ;-)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 23 March 2017 at 09:53:17, kant kodali (kanth...@gmail.com) wrote:

Hi All,

I originally posted this question on SO and tried it myself but unable to
find what I am  doing wrong? I get the following error. I followed this
documentation
https://www.playframework.com/documentation/2.5.x/JavaWebSockets.


[error] /Users/hello/Documents/java/test_app/conf/routes:8: Cannot use a
method returning play.mvc.WebSocket[?0] as a Handler for requests

[error] GET /txstatus
controllers.Application.handleWebSocketConnection()

[error] /Users/hello/Documents/java/test_app/conf/routes:8: not enough
arguments for method createInvoker: (implicit hif:
play.core.routing.HandlerInvokerFactory[play.mvc.WebSocket[?0]])play.core.routing.HandlerInvoker[play.mvc.WebSocket[?0]].

[error] two errors found

[error] (compile:compile) Compilation failed




*Here is the problem Description:*




GET/statuscontrollers.Application.handleWebSocketConnection()

Here is the relevant source code.

public WebSocket handleWebSocketConnection() {
return WebSocket.withActor(new F.Function() {
@Override
public Props apply(ActorRef actorRef) throws Throwable {
return UserActor.props(actorRef, "");
}
});}

here is my build.sbt

import play.routes.compiler.InjectedRoutesGeneratorimport play.sbt.PlayScala

name := "hello"

version := "1.0"

lazy val `dashboard` = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
  jdbc ,
  cache ,
  ws   ,
  specs2 % Test,
  "io.netty" % "netty-all" % "4.0.0")

unmanagedResourceDirectories in Test <+=  baseDirectory ( _
/"target/web/public/test" )

resolvers ++= Seq(
  "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases;)

routesGenerator := InjectedRoutesGenerator

fork in run := true

I am using Play version 2.4.2 and all the source code is in java 8. I get
the following error

Cannot use a method returning play.mvc.WebSocket[?0] as a Handler for requests

any ideas?

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.

-- 
>>  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] Does Activator require SBT ? Can it work with gradle?

2017-03-22 Thread Konrad Malawski
As I just mentioned, we're working on it, there will be a replacement ;)

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 22 March 2017 at 13:46:46, kant kodali (kanth...@gmail.com) wrote:

oh if you guys are deprecating activator what is its replacement? Any
pointer on the web I can follow?

On Wednesday, March 22, 2017 at 4:32:35 AM UTC-7, Konrad Malawski wrote:
>
> Thanks!
>
> It does require it. It is only a getting started tool so you should not
> really care. Your normal development you do in whichever thing you want.
> It is also being deprecated in favour of new tools we're working on at
> Lightbend.
>
> --
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 22 March 2017 at 13:31:15, kant kodali (kant...@gmail.com) wrote:
>
> Hi All,
>
> I love the activator tool. Whoever implemented a big thanks! I am
> wondering if it require SBT ? can it work with gradle (since we currently
> use gradle)?
>
> 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+...@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.

-- 
>>>>>>>>>>  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] Does Activator require SBT ? Can it work with gradle?

2017-03-22 Thread Konrad Malawski
Thanks!

It does require it. It is only a getting started tool so you should not
really care. Your normal development you do in whichever thing you want.
It is also being deprecated in favour of new tools we're working on at
Lightbend.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 22 March 2017 at 13:31:15, kant kodali (kanth...@gmail.com) wrote:

Hi All,

I love the activator tool. Whoever implemented a big thanks! I am wondering
if it require SBT ? can it work with gradle (since we currently use gradle)?

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.

-- 
>>  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] How to group a list of actors in Akka?

2017-03-22 Thread Konrad Malawski
On 22 March 2017 at 03:06:34, kant kodali (kanth...@gmail.com) wrote:

I think I understand it better from what you said. I guess I don't have
separate parent for each group therefore I was looking to see how to group
the child actors but anyways since it is not the standard approach from
what you are saying I would not go that way. I believe I can leverage event
bus  for this
since all I want to do is broadcast different messages to different groups
of actors within a single JVM.

Maybe, not sure what your exact use case is. Picking the simplest thing to
solve your problem is usually a good rule of thumb



Is it recommended to have multiple actors systems within the same JVM? I am
using the Play framework and it has a default Actor system but I wondering
if I should use Actor system provided by the Play framework or create my
own to leverage event bus?

One system is fine, do however read about blocking (google "akka blocking")
to learn how to configure dispatchers to avoid blocking the main dispatcher.



I am assuming the different between pub-sub and event bus is one is
distributed and other is not respectively. isn't it?

Yeah, event-bus is just a quick local thing. Distributed Pub Sub is
distributed pub-sub :)


-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

-- 
>>  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] How to group a list of actors in Akka?

2017-03-21 Thread Konrad Malawski
As such, no -- there's no formal "group" concept like this, although you
could construct it manually yourself.

There is "all children of given actor" which is accessible by
context.children() inside an Actor.




-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 


On 21 March 2017 at 15:02:26, Justin du coeur (jduco...@gmail.com) wrote:

-- 
>>  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] MergePreferred with different priorities on all inlets

2017-03-20 Thread Konrad Malawski
No, feel free to build a stage like that and contribute to
akka-stream-contrib - would be nice :)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 20 March 2017 at 15:23:03, Sergey Sopin (sopin1...@gmail.com) wrote:

Hi,

Is there any way to set different priorities on different inlets in
MergePreferred if it has more that two inlets?

Thanks!

Regards,
Sergey
--
>> 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] ANNOUNCE: Akka HTTP 10.0.5 Released!

2017-03-17 Thread Konrad Malawski
Dear hakkers,

we — the Akka HTTP committers — are happy to announce Akka Http 10.0.5,
which is the fifth maintenance release of the Akka Http 10.0 series. It is
primarily aimed at stability aligning the internals with the upcoming Akka
2.5 release. These steps are also the groundwork to enable Play to make use
of Akka HTTP and the new Akka Streams materializer in the upcoming Play 2.6.

The Scala 2.11 version is already on Maven Central and the 2.12 version
should appear shortly, thanks for your patience.
List of ChangesImprovements:AKKA-HTTP-CORE

   - New docs and API for registering custom headers with JavaDSL (#761
   )
   - Ssl-config upgraded to 0.2.2, allows disabling/changing hostname
   verification (#943 )
   - Don’t depend on Akka internal APIs, become compatible with Akka 2.5 (
   #877 )
   - Make default exception handler logging more informative (#887
   )

AKKA-HTTP

   - Unmarshal.to now uses the materializer ExecutionContext if no other
   provided implicitly (#947 )

Bug fixes:AKKA-HTTP-CORE

   - Prevent longer-than-needed lingering streams by fixing
   DelayCancellationStage (#945
   )

AKKA-HTTP

   - Avoid redirect-loop when redirectToNoTrailingSlashIfPresent was used
   for root path (#878 )

Compatibility notes

This version of Akka HTTP must be used with Akka in version at-least
2.4.17, however it is also compatible with Akka 2.5, which has just
released its Release Candidate 1.

Akka HTTP 10.0.x will remain compatible with Akka 2.4.x and Akka 2.5.x
during its lifetime, yet it may require the respective latest version of
Akka itself. Since Akka guarantees binary compatibility

in
such versions, it is trivial to upgrade both projects in case you need to
do so.

We encourage you to try out Akka 2.5 release candidate with this version,
as the new completely redesigned materializer in Akka Streams can result in
various performance and memory usage improvements across the board.

Akka 10.0.x is backwards binary compatible with previous 10.0.x releases
and Akka 2.4.x. This means that the new JARs are a drop-in replacement for
the old one (but not the other way around) as long as your build does not
enable the inliner (Scala-only restriction). It should be noted that Scala
2.12.x is is not binary compatible with Scala 2.11.x.
Credits

A total 23 issues were closed since 10.0.4.

The complete list of closed issues can be found on the 10.0.5
 milestones on
github.

For this release we had the help of 13 contributors – thank you all very
much!

commits  added  removed
 18591  256 Johannes Rudolph
 12 52   56 Jonas Fonseca
  45065 Josep Prat
  2 46   28 Aurélien Thieriot
  2 146 Sergey Shishkin
  1118   27 Roman Tkalenko
  1 36   17 btomala
  1 144 Jakub Kozłowski
  1  21 Desmond Yeung
  1  11 WANG GAOXIANG (Eric)
  1  20 John Zhang
  1  11 Vova Molin
  1  11 Konrad `ktoso` Malawski

Happy hakking!

– The Akka Team

-- 
Cheers,
Konrad 'ktoso' Malawski
Akka  @ Lightbend 

-- 
>>  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] How akka cluster become network partition

2017-03-16 Thread Konrad Malawski
Network is network. Does not matter if something is close or far.

This applies to all distributed systems or databases. Just some prefer to
not tallboy about it and then you notice once it's too late and you're
screwed ;-)
In All we prefer to be upfront and honest about those things. As Patrik
linked, we also have advanced mechanisms to help you in those situations.

On Mar 17, 2017 02:11, "Dai Yinhua"  wrote:

> Does it happen if all servers are inside a LAN?
>
> --
> >> 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] Spark Streaming using Kafka as a source and Akka with kafka ?

2017-03-16 Thread Konrad Malawski
Use this: https://github.com/akka/reactive-kafka

Also, please note that Spark and Akka are not really directly competing...
Think about it this way:
Can you build an HTTP server with Spark Streaming? Nope.
Can you do that with Akka Streams? Yes.
Does Akka Streams have built in machine learning things? Nope. You could
use external ones though.

etc. etc.

They are very very different technologies, even if the word "stream"
appears in both of them.
Take a look at my recent talk about this:
https://www.slideshare.net/ktoso/akkachans-survival-guide-for-the-streaming-world


Happy hakking

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 16 March 2017 at 10:32:14, Rida Amine (rida.bigman.am...@gmail.com)
wrote:

hey there,
what i'm trying to do is compare Spark Streaming using Kafka as a source
and Akka with kafka
i managed to link Spark Streaming with kafka using DirectStream, but im
stuck when it comes to spark streaming with akka and kafka
i don't understand how to make that connection
thanks in advance.
--
>> 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] Akka Streams + TCP + TLS

2017-03-15 Thread Konrad Malawski
> at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:
>> 1056)
>> at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
>> at java.util.concurrent.ForkJoinWorkerThread.run(
>> ForkJoinWorkerThread.java:157)
>> Caused by: java.lang.NoClassDefFoundError: scala/runtime/java8/JFunction1
>> ... 38 more
>> Caused by: java.lang.ClassNotFoundException:
>> scala.runtime.java8.JFunction1
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>> ... 38 more
>>
>>
>> Any idea ?
>> Thank you!
>>
>> El lunes, 13 de marzo de 2017, 22:13:57 (UTC-3), Pablo Milanese escribió:
>>>
>>> Hello Konrad,
>>>
>>> Of course! No problem.
>>> I will take a look to the code.
>>>
>>> Thank you a lot !
>>>
>>>
>>>
>>> El lunes, 13 de marzo de 2017, 18:28:42 (UTC-3), Konrad Malawski
>>> escribió:
>>>>
>>>> (did the conversion in a rush)
>>>>
>>>> --
>>>> Konrad `ktoso` Malawski
>>>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>>>
>>>> On 13 March 2017 at 22:26:51, Pablo Milanese (pablomi...@gmail.com)
>>>> wrote:
>>>>
>>>>  https://github.com/typesafehub/activator-akka-
>>>> stream-java8/blob/master/src/main/java/sample/stream/TcpTLSEcho.java
>>>>
>>>> --
>>>>>>>>>> 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] Disable hostname verification

2017-03-15 Thread Konrad Malawski
Read the docs:
http://doc.akka.io/docs/akka/current/scala/http/client-side/https-support.html#Hostname_verification

You should also force the SSL Config library to be 0.2.2


-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 15 March 2017 at 09:00:55, rdineshfirstd...@gmail.com (
rdineshfirstd...@gmail.com) wrote:

Hi Team,
How do we disable Host verification using Akka http? Getting below
exception.

akka.stream.ConnectionException: Hostname verification failed!


Code:

http.setDefaultClientHttpsContext(HttpsConnectionContext.https(context));

conSecure = ConnectHttp.toHostHttps(properties.getHost(), properties.getPort());

cstage = Source.single(hrequest)
  .via(http
.outgoingConnection(conSecure)
  )
  .runWith(Sink.head(), materializer)
;

return cstage;


On Monday, February 22, 2016 at 9:17:49 AM UTC-6, Akka Team wrote:
>
> Hi Michael,
>
> On Mon, Feb 22, 2016 at 4:04 PM, Michi 
> wrote:
>
>> Hi Roland,
>>
>>
>>> I don’t agree: if you write a program that shall have certain security
>>> characteristics, then you must certainly test it under the same constraints
>>> that you will run it with in production. Otherwise you run something that
>>> you have not tested. How would you test the failure scenarios where
>>> precisely these hostname checks fail? This should be handled (and probably
>>> reported) properly.
>>>
>>> Therefore I don’t see the private CA as a workaround, I see it as a
>>> necessity so that security is practiced by everyone involved.
>>>
>>>
>> I have to admit my knowledge about SSL/TLS is very limited. But if
>> hostname verification is causing trouble in our production code, I would
>> not hesitate to switch it off for production code. Our code is used in an
>> intranet, anyway and I am really not worried about man-in-the-middle
>> attacks.
>>
>
> In this case the proper solution is to add the certificate of that service
> to a truststore. Then the truststore can be relatively easily installed on
> the client machines, i.e. you need to do this once.
>
>
>>
>> The obvious question is, why use https at all? I wouldn't, but the
>> software we connect to is https only, so we have to live with it. This
>> might be an exception and I guess we can get everything working with
>> hostname verification (or maybe it just works, I did not try it yet). I am
>> just not eager to spend lots of time to get security right if security is
>> basically irrelevant, anyway.
>>
>
> This is a very specific use case though.
>
> -Endre
>
>
>> Best regards,
>> 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+...@googlegroups.com.
>> To post to this group, send email to akka...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Akka Team
> Typesafe - Reactive apps on the JVM
> Blog: letitcrash.com
> Twitter: @akkateam
>
--
>> Read the docs: http://akka.io/docs/
>> Check the FAQ:
http://doc.akka.io/docs/akka/current/additional/faq.html
>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups
"Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>  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 Streams + TCP + TLS

2017-03-13 Thread Konrad Malawski
(did the conversion in a rush)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 13 March 2017 at 22:26:51, Pablo Milanese (pablomilanes...@gmail.com)
wrote:


https://github.com/typesafehub/activator-akka-stream-java8/blob/master/src/main/java/sample/stream/TcpTLSEcho.java

-- 
>>  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 Streams + TCP + TLS

2017-03-13 Thread Konrad Malawski
I started it for scala here

https://github.com/typesafehub/activator-akka-stream-scala
However I made some mistake somewhere - would be awesome if you could help
me notice where the mistake was :/

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 13 March 2017 at 22:26:51, Pablo Milanese (pablomilanes...@gmail.com)
wrote:


https://github.com/typesafehub/activator-akka-stream-java8/blob/master/src/main/java/sample/stream/TcpTLSEcho.java

-- 
>>  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 Streams + TCP + TLS

2017-03-12 Thread Konrad Malawski
Here's a full example which does just that:
https://github.com/typesafehub/activator-akka-stream-java8/blob/master/src/main/java/sample/stream/TcpTLSEcho.java

Happy hakking


On Mar 11, 2017 10:43 AM, "Pablo Milanese" 
wrote:

> Hello !.
>
> I am actually looking for an example of the combinations of
> *akka.streams.javadsl.Tcp* and *akka.streams.javadsl.TLS* to create
> custom SSL/TLS enabled TCP servers and clients, but I couldn't find
> anything ..
>
> I think I have resolved the akka-streams-tcp, but I can't find how can I
> join the TLS API on the things that I have:
>
> Here's my code for TCP connections using akka streams:
>
>
>
>   private val connectionsSource: Source[IncomingConnection, 
> Future[ServerBinding]] =
> Tcp(context.system)
>   .bind(transportConfig.getHost, transportConfig.getPort)
>
>   private val connectionsSink: Sink[IncomingConnection, Future[Done]] =
> Sink.foreach(handleIncomingConnection)
>
>   private val connectionsGraph: RunnableGraph[(Future[ServerBinding], 
> Future[Done])] =
> connectionsSource.toMat(connectionsSink)(Keep.both)
>
>   private val echo: Flow[ByteString, ByteString, NotUsed] =
>
> Flow[ByteString]
>   .via(Framing.delimiter(ByteString("\n"), maximumFrameLength = 256, 
> allowTruncation = true))
>   .map(_.utf8String)
>   .map { text =>
> log.info(s"Received message: $text")
> ByteString(text + "!!!\n")
>   }
>
>   def handleIncomingConnection(connection: IncomingConnection) {
> log.info(s"New client at ${connection.remoteAddress}")
> val flowGraph = connection.flow.joinMat(echo)(Keep.both)
> flowGraph.run()
>   }
>
>   private val mat = connectionsGraph.run()
>
>
>
> And from the other side, the TLS part:
>
> ( I have a Function to take the SSLContext .. but is the only thing that I
> have ...)
>
> def initSslContext(): SSLContext = {
>   val password = "password"
>
>   val keyStore = KeyStore.getInstance(KeyStore.getDefaultType)
>   keyStore.load(getClass.getResourceAsStream("/keystore"), 
> password.toCharArray)
>
>   val trustStore = KeyStore.getInstance(KeyStore.getDefaultType)
>   trustStore.load(getClass.getResourceAsStream("/truststore"), 
> password.toCharArray)
>
>   val keyManagerFactory = 
> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm)
>   keyManagerFactory.init(keyStore, password.toCharArray)
>
>   val trustManagerFactory = 
> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm)
>   trustManagerFactory.init(trustStore)
>
>   val context = SSLContext.getInstance("TLS")
>   context.init(keyManagerFactory.getKeyManagers, 
> trustManagerFactory.getTrustManagers, new SecureRandom)
>
>   for (protocol <- context.getSupportedSSLParameters.getProtocols) {
> log.info(s"Supported protocol: $protocol")
>   }
>   context
> }
>
>
>
> If anyone has an example, or something I would appreciate.
>
> Thank You!
> Pablo
>
>
>
> --
> >> 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] Run akka-bench-jmh benchmarks

2017-03-09 Thread Konrad Malawski
Please read the plugins docs: https://github.com/ktoso/sbt-jmh

> jmh:run


:-)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 9 March 2017 at 22:52:44, AbhijitPratap Singh (
singhabhijitpra...@gmail.com) wrote:

I was intending to run the jmh benchmarks for akka located in
akka-bench-jmh project dir.

I compiled the source code by running `sbt package` and then `sbt
akka-bench-jmh/run`. This fails with the following reason

java.lang.RuntimeException: ERROR: Unable to find the resource:
/META-INF/BenchmarkList.


I have attached the snapshot. I'm guessing its an issue with sbt-jmh
plugin. I am not getting enough clues to fix this issue. Any ideas would be
quite helpful.


--
>> 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] AKKA crashed using kryo serialization sometimes

2017-03-06 Thread Konrad Malawski

Really? I was thing serialization would be needed for inter process 
communication.
If you're in the same JVM then it's only inter-thread communication, so we 
don't serialize (unless you force that via config setting)



Thanks, looking forward to a reproducer - most likely best to ping the kryo 
plugin people, thanks!



-- Konrad


-- 
>>  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: Persistent FSM and at least once delivery

2017-03-05 Thread Konrad Malawski
Thanks for the ticket, let us know if you have a moment to try it out :)

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 5 March 2017 at 22:27:15, Tomer Rothschild (roto...@cloudshare.com)
wrote:

Thanks for the quick reply :)

I have created the following ticket to track this issue -
https://github.com/akka/akka/issues/22457
Thanks for considering the request.

I hope to provide feedback on how such mixin works out within the next
month or two.

On Sunday, March 5, 2017 at 4:24:29 PM UTC+2, Tomer Rothschild wrote:
>
> Hi
>
> I'm considering using Akka for my team's next big project in Java.
>
> I find both of the following capabilities to be desirable in the same
> actor:
>
>1. Persistent FSM
>2. At least once delivery
>
> I haven't found a Java abstract actor class that provides both
> functionalities.
>
> So my questions are:
>
>- Is it possible to have an actor with both capabilities in Java?
>- If not:
>-
>   - Is it possible in Scala (using traits)?
>   - Is there a plan to include an actor with such capabilities in the
>   coming releases?
>
> Thanks in advance,
> Tomer R.
>
> P.S.
> I found the same question unanswered in stack overflow -
> http://stackoverflow.com/questions/39374797/can-i-mix-
> persistenct-fsm-and-at-least-once-message-delivery-in-akka
>
--
>> 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] Persistent FSM and at least once delivery

2017-03-05 Thread Konrad Malawski
I'm considering using Akka for my team's next big project in Java.

Very cool, thanks for reaching out too.

I find both of the following capabilities to be desirable in the same actor:

   1. Persistent FSM
   2. At least once delivery

I haven't found a Java abstract actor class that provides both
functionalities.

So my questions are:

   - Is it possible to have an actor with both capabilities in Java?
   - If not:
   -
  - Is it possible in Scala (using traits)?

I think it should work, yes - simply extends PersistentFSM with
AtLeastOnceDelivery should do the job.

I don't think we have tried this though, so please check and report back :)


   -
  - Is there a plan to include an actor with such capabilities in the
  coming releases?

This is the first time someone asked for it actually. Please open a ticket
on github.com/akka/akka and we can think about it.

If the above works (please let us know), then providing it is rather simple
and we could do so yeah.


-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

-- 
>>  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 2.4.3] - Cannot marshal Source[A,NotUsed] in presence of a ToResponseMarshaller[A]

2017-03-03 Thread Konrad Malawski
Thanks for your patience and posting the reproducer, makes it much easier
to find what's wrong :)

There is one small typo basically, you need to provide a
*ToEntityMarshaller* and not a To*Response*Marshaller.
Think of it this way, you should provide the "most basic" marshaller and
then the more complex ones will be derived from the simple one.
So here you really render just the Entity, not the entire Response, so
that's what you should provide.

The multiple "entities" are separated by the framing you picked and this
way you get what you wanted - a json array framed list of strings for
example.

In my blog
http://kto.so/2016/04/10/hakk-the-planet-implementing-akka-http-marshallers/
i explained a bit how you can go about debugging "which marshaller" is
missing,
so perhaps this would have helped you here a bit too.

Cheers, have a nice weekend!

On Wed, Mar 1, 2017 at 5:04 PM, Edmondo Porcu <
edmondo.po...@gottexbrokers.com> wrote:

> Hello everyone,
>
> what is required to get the following compile?
>
> class TestUnmarshalling{
>
>   sealed trait Xor[+A,+B]
>   object Xor{
> def left[A,B](a:A):Xor[A,B] = Left(a)
> def right[A,B](b:B):Xor[A,B] = Right(b)
>   }
>
>   case class Left[A] (a:A)extends Xor[A,Nothing]
>   case class Right[B](b:B) extends Xor[Nothing,B]
>
>   implicit val actorSystem = ActorSystem()
>   implicit val actorMaterializer = ActorMaterializer()
>
>   implicit val xorMarshallers:ToResponseMarshaller[Xor[Throwable,String]]
> = ???
>
>   private val routes = path("pippo") {
> pathEnd {
>   get {
> complete(Xor.left[Throwable, String](new
> NullPointerException("hello world")))
>   } ~
> post {
>   implicit val streamingSupport = EntityStreamingSupport.json()
>   val s = Source.single(Xor.left[Throwable, String](new
> NullPointerException("hello world")))
>   complete(s)
> }
> }
>   }
>
>
> }
>
> The get part of the route compile, the post doesn't. It looks like the
> toResponseMarshaller isn't enough to get that source to marshal?
>
> Thanks
>
> Edmondo
>
> --
> >> 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,
Konrad 'ktoso' Malawski
Akka  @ Typesafe 

-- 
>>  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 crashed using kryo serialization sometimes

2017-03-03 Thread Konrad Malawski
The reason it does not blow up locally is because then you don't hit the
serialiser :)

On Fri, Mar 3, 2017 at 9:26 AM, Konrad Malawski <
konrad.malaw...@typesafe.com> wrote:

> This sounds like it would be better reported at https://github.com/romix/
> akka-kryo-serialization
> best with a reproducer so the maintainers there could try to figure it out.
>
> On Fri, Mar 3, 2017 at 8:44 AM, Dai Yinhua <yhdai.2...@gmail.com> wrote:
>
>> A few updates.
>>
>> 1. The crash only happened when I run akka cluster in different nodes,
>> i.e. cross node transportation.
>> If I start akka cluster in one single server, it won't crash.
>>
>> 2. When I set post-serialization-transformations to "off"(previous is
>> "lz4,aes"), the crash is gone even run in several nodes.
>>
>> --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>> urrent/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,
> Konrad 'ktoso' Malawski
> Akka <http://akka.io/> @ Typesafe <http://typesafe.com/>
>



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


  1   2   3   4   5   6   7   8   9   10   >