Re: [akka-user] How to stop an Actor using akka-http's actor-per-request example without getting an Abrupt Termination?

2016-03-19 Thread Konrad Malawski
Yeah, thanks Samuel for linking to the issue.
Interested parties please watch that issue and PR :)

On Tue, Mar 15, 2016 at 9:51 AM, Samuel Tardieu  wrote:

> I think this is a bug: https://github.com/akka/akka/issues/20032
>
>
> Le mar. 15 mars 2016 à 03:57, Sam Smoot  a écrit :
>
>> That fixed it! I can't thank you enough!
>>
>>
>> On Monday, March 14, 2016 at 5:43:05 PM UTC-5, Samuel Tardieu wrote:
>>
>>> Could it be that since you define an implicit Materializer in your
>>> actor which is tied to the implicit ActorRefFactory (which would be
>>> context inside the actor), it is the one used for singleRequest which
>>> requires an implicit Materializer? Can you try defining your
>>> Materializer as ActorMaterializer()(context.system) and see if it
>>> changes the outcome?
>>> ​
>>>
>>>
>>> Le lun. 14 mars 2016 à 18:36, Sam Smoot  a écrit :
>>>
>> So if you look at the example in the docs:
 http://doc.akka.io/docs/akka/2.4.2/scala/http/client-side/request-level.html#Using_the_Future-Based_API_in_Actors

 That works fine. Except it's incomplete since it's obviously a
 single-use Actor (the request is fired off in preStart) and it doesn't show
 how to clean it up.

 I'm trying to implement this in my project, but sending context.self !
 PoisonPill to my Actor after consuming the response will reliably cause an
 AbruptTerminationException.

 I've whipped up a gist here that hopefully demonstrates the issue (with
 lots of comments): https://gist.github.com/sam/7731f883a62b329c6592

 Any help? I got a suggestion it might have something to do with the
 connection pool, but I'm not sure how to handle that. Should I pass the
 pool into my actor's constructor? Where do I get the pool? How do I pass it
 to singleRequest, which appears to take a ConnectionPoolSettings object?

 Thanks, -Sam

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



-- 
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 to stop an Actor using akka-http's actor-per-request example without getting an Abrupt Termination?

2016-03-15 Thread Samuel Tardieu
I think this is a bug: https://github.com/akka/akka/issues/20032

Le mar. 15 mars 2016 à 03:57, Sam Smoot  a écrit :

> That fixed it! I can't thank you enough!
>
>
> On Monday, March 14, 2016 at 5:43:05 PM UTC-5, Samuel Tardieu wrote:
>
>> Could it be that since you define an implicit Materializer in your actor
>> which is tied to the implicit ActorRefFactory (which would be context
>> inside the actor), it is the one used for singleRequest which requires
>> an implicit Materializer? Can you try defining your Materializer as
>> ActorMaterializer()(context.system) and see if it changes the outcome?
>> ​
>>
>>
>> Le lun. 14 mars 2016 à 18:36, Sam Smoot  a écrit :
>>
> So if you look at the example in the docs:
>>> http://doc.akka.io/docs/akka/2.4.2/scala/http/client-side/request-level.html#Using_the_Future-Based_API_in_Actors
>>>
>>> That works fine. Except it's incomplete since it's obviously a
>>> single-use Actor (the request is fired off in preStart) and it doesn't show
>>> how to clean it up.
>>>
>>> I'm trying to implement this in my project, but sending context.self !
>>> PoisonPill to my Actor after consuming the response will reliably cause an
>>> AbruptTerminationException.
>>>
>>> I've whipped up a gist here that hopefully demonstrates the issue (with
>>> lots of comments): https://gist.github.com/sam/7731f883a62b329c6592
>>>
>>> Any help? I got a suggestion it might have something to do with the
>>> connection pool, but I'm not sure how to handle that. Should I pass the
>>> pool into my actor's constructor? Where do I get the pool? How do I pass it
>>> to singleRequest, which appears to take a ConnectionPoolSettings object?
>>>
>>> Thanks, -Sam
>>>
>>> --
>>> >> 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] How to stop an Actor using akka-http's actor-per-request example without getting an Abrupt Termination?

2016-03-14 Thread Sam Smoot
Ah. I didn't realize self was a val. I always assumed it was just a 
delegating method to context.self. Thanks for the tip.

For posterity: I was trying to provide a local val the closure I was using 
for my Future callback could capture so that if the underlying ActorRef 
returned by context.self changed it wouldn't cause issues. Since it's 
already defined as a val that's just unnecessary here. At least that's my 
understanding.

Thanks again, -Sam

On Monday, March 14, 2016 at 5:37:02 PM UTC-5, Samuel Tardieu wrote:
>
> As a side node: self is already defined as context.self in Actor, you can 
> use that directly.
> ​
>
> Le lun. 14 mars 2016 à 18:36, Sam Smoot  
> a écrit :
>
>> So if you look at the example in the docs: 
>> http://doc.akka.io/docs/akka/2.4.2/scala/http/client-side/request-level.html#Using_the_Future-Based_API_in_Actors
>>
>> That works fine. Except it's incomplete since it's obviously a single-use 
>> Actor (the request is fired off in preStart) and it doesn't show how to 
>> clean it up.
>>
>> I'm trying to implement this in my project, but sending context.self ! 
>> PoisonPill to my Actor after consuming the response will reliably cause an 
>> AbruptTerminationException.
>>
>> I've whipped up a gist here that hopefully demonstrates the issue (with 
>> lots of comments): https://gist.github.com/sam/7731f883a62b329c6592
>>
>> Any help? I got a suggestion it might have something to do with the 
>> connection pool, but I'm not sure how to handle that. Should I pass the 
>> pool into my actor's constructor? Where do I get the pool? How do I pass it 
>> to singleRequest, which appears to take a ConnectionPoolSettings object?
>>
>> Thanks, -Sam
>>
>> -- 
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] How to stop an Actor using akka-http's actor-per-request example without getting an Abrupt Termination?

2016-03-14 Thread Sam Smoot
That fixed it! I can't thank you enough!

On Monday, March 14, 2016 at 5:43:05 PM UTC-5, Samuel Tardieu wrote:
>
> Could it be that since you define an implicit Materializer in your actor 
> which is tied to the implicit ActorRefFactory (which would be context 
> inside the actor), it is the one used for singleRequest which requires an 
> implicit Materializer? Can you try defining your Materializer as 
> ActorMaterializer()(context.system) and see if it changes the outcome?
> ​
>
>
> Le lun. 14 mars 2016 à 18:36, Sam Smoot  
> a écrit :
>
>> So if you look at the example in the docs: 
>> http://doc.akka.io/docs/akka/2.4.2/scala/http/client-side/request-level.html#Using_the_Future-Based_API_in_Actors
>>
>> That works fine. Except it's incomplete since it's obviously a single-use 
>> Actor (the request is fired off in preStart) and it doesn't show how to 
>> clean it up.
>>
>> I'm trying to implement this in my project, but sending context.self ! 
>> PoisonPill to my Actor after consuming the response will reliably cause an 
>> AbruptTerminationException.
>>
>> I've whipped up a gist here that hopefully demonstrates the issue (with 
>> lots of comments): https://gist.github.com/sam/7731f883a62b329c6592
>>
>> Any help? I got a suggestion it might have something to do with the 
>> connection pool, but I'm not sure how to handle that. Should I pass the 
>> pool into my actor's constructor? Where do I get the pool? How do I pass it 
>> to singleRequest, which appears to take a ConnectionPoolSettings object?
>>
>> Thanks, -Sam
>>
>> -- 
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] How to stop an Actor using akka-http's actor-per-request example without getting an Abrupt Termination?

2016-03-14 Thread Samuel Tardieu
Could it be that since you define an implicit Materializer in your actor
which is tied to the implicit ActorRefFactory (which would be context
inside the actor), it is the one used for singleRequest which requires an
implicit Materializer? Can you try defining your Materializer as
ActorMaterializer()(context.system) and see if it changes the outcome?
​


Le lun. 14 mars 2016 à 18:36, Sam Smoot  a écrit :

> So if you look at the example in the docs:
> http://doc.akka.io/docs/akka/2.4.2/scala/http/client-side/request-level.html#Using_the_Future-Based_API_in_Actors
>
> That works fine. Except it's incomplete since it's obviously a single-use
> Actor (the request is fired off in preStart) and it doesn't show how to
> clean it up.
>
> I'm trying to implement this in my project, but sending context.self !
> PoisonPill to my Actor after consuming the response will reliably cause an
> AbruptTerminationException.
>
> I've whipped up a gist here that hopefully demonstrates the issue (with
> lots of comments): https://gist.github.com/sam/7731f883a62b329c6592
>
> Any help? I got a suggestion it might have something to do with the
> connection pool, but I'm not sure how to handle that. Should I pass the
> pool into my actor's constructor? Where do I get the pool? How do I pass it
> to singleRequest, which appears to take a ConnectionPoolSettings object?
>
> Thanks, -Sam
>
> --
> >> 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 stop an Actor using akka-http's actor-per-request example without getting an Abrupt Termination?

2016-03-14 Thread Samuel Tardieu
As a side node: self is already defined as context.self in Actor, you can
use that directly.
​

Le lun. 14 mars 2016 à 18:36, Sam Smoot  a écrit :

> So if you look at the example in the docs:
> http://doc.akka.io/docs/akka/2.4.2/scala/http/client-side/request-level.html#Using_the_Future-Based_API_in_Actors
>
> That works fine. Except it's incomplete since it's obviously a single-use
> Actor (the request is fired off in preStart) and it doesn't show how to
> clean it up.
>
> I'm trying to implement this in my project, but sending context.self !
> PoisonPill to my Actor after consuming the response will reliably cause an
> AbruptTerminationException.
>
> I've whipped up a gist here that hopefully demonstrates the issue (with
> lots of comments): https://gist.github.com/sam/7731f883a62b329c6592
>
> Any help? I got a suggestion it might have something to do with the
> connection pool, but I'm not sure how to handle that. Should I pass the
> pool into my actor's constructor? Where do I get the pool? How do I pass it
> to singleRequest, which appears to take a ConnectionPoolSettings object?
>
> Thanks, -Sam
>
> --
> >> 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.