On Thu, Sep 10, 2015 at 4:27 PM, Matthew Adams <[email protected]>
wrote:

> That was it, Endre.  I added
>
> Http().shutdownAllConnectionPools() andThen { case _ => system.shutdown()
> }
>
> and it terminated normally.  Thanks for the RTFM.
>
No worries, current docs contain quite a lot of information, but it is hard
to find them. Nevertheless docs need to start from somewhere, they will
probably just improve over time :)

-Endre


>
> -matthew
>
> On Thursday, September 10, 2015 at 4:44:19 AM UTC-5, Akka Team wrote:
>>
>> Hi Matthew
>>
>> You are using the request-based HTTP client API which is only a thin
>> wrapper around the connection pool APIs. I recommend to take a look at the
>> documentation of the various pools:
>>
>>
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/client-side/host-level.html
>>
>> What happens in your sample is that the underlying pool is not shut down,
>> but lingers around, and as you pull the ActorSystem from under its feet it
>> terminates abruptly. You can read about pool shutdowns here:
>>
>>
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/client-side/host-level.html#pool-shutdown
>>
>> What you probably need from there is a call to
>> Http().shutdownAllConnectionPools() which will return a Future[Unit] which
>> will signal the proper completion of the pools.
>>
>> -Endre
>>
>> On Wed, Sep 9, 2015 at 8:36 PM, Matthew Adams <[email protected]>
>> wrote:
>>
>>> The sample code
>>>
>>> *object Main extends App {*
>>>
>>>
>>>
>>> *  implicit val system = ActorSystem("akka-http-core")*
>>>
>>> *  implicit val materializer = ActorMaterializer()*
>>>
>>>
>>> *  val uri =
>>> Uri("http://maps.googleapis.com/maps/api/elevation/json?locations=27.988056,86.925278
>>> <http://maps.googleapis.com/maps/api/elevation/json?locations=27.988056,86.925278>")*
>>>
>>>
>>> *  Http().singleRequest(HttpRequest(uri = uri)) onComplete {*
>>>
>>> *    case Success(res) => {*
>>>
>>> *      res.entity.dataBytes.runFold("")((s, b) => s + b.utf8String)
>>> onComplete {*
>>>
>>> *        case Success(s) => {*
>>>
>>> *          println(s)*
>>>
>>>           *system.shutdown()*
>>>
>>> *        }*
>>>
>>> *        case Failure(t) => {*
>>>
>>> *          println(t)*
>>>
>>>           *system.shutdown()*
>>>
>>> *        }*
>>>
>>> *      }*
>>>
>>> *    }*
>>>
>>> *    case Failure(bad) => {*
>>>
>>> *      println(bad)*
>>>
>>>       *system.shutdown()*
>>>
>>> *    }*
>>>
>>> *  }*
>>>
>>> *}*
>>>
>>> prints the response fine but consistently produces an error:
>>>
>>> *{*
>>> *   "results" : [*
>>> *      {*
>>> *         "elevation" : 8815.7158203125,*
>>> *         "location" : {*
>>> *            "lat" : 27.988056,*
>>> *            "lng" : 86.92527800000001*
>>> *         },*
>>> *         "resolution" : 152.7032318115234*
>>> *      }*
>>> *   ],*
>>> *   "status" : "OK"*
>>> *}*
>>>
>>> *[ERROR] [09/09/2015 13:27:43.956]
>>> [akka-http-core-akka.actor.default-dispatcher-11]
>>> [ActorSystem(akka-http-core)] Outgoing request stream error
>>> (akka.stream.AbruptTerminationException)*
>>> *[success] Total time: 5 s, completed Sep 9, 2015 1:27:43 PM*
>>>
>>> When is the right time to call ActorSystem.shutdown() in order to
>>> terminate without errors?
>>>
>>> TIA,
>>> Matthew
>>>
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ:
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >>>>>>>>>> Search the archives:
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to