I'm trying to connect to a third party streaming API over HTTPS using
"akka-stream-experimental" % "1.0-RC4" and "akka-http-experimental" %
"1.0-RC4"
My code looks like this
class GnipStreamHttpClient(host: String, account: String, processor:
>> ActorRef) extends Actor with ActorLogging {
>
> this: Authorization =>
>
>
>> private val system = context.system
>
> private val endpoint = Uri(s"https://$host/somepath")
>
> private implicit val executionContext = system.dispatcher
>
> private implicit val flowMaterializer: Materializer =
>> ActorMaterializer(ActorMaterializerSettings(system))
>
>
>> val client = Http(system).outgoingConnectionTls(host, port, settings =
>> ClientConnectionSettings(system))
>
>
>> override def receive: Receive = {
>
> case response: HttpResponse if response.status.intValue / 100 == 2 =>
>
> response.entity.dataBytes.map(processor ! _).runWith(Sink.ignore)
>
> case response: HttpResponse =>
>
> log.info(s"Got unsuccessful response $response")
>
> case _ =>
>
> val req = HttpRequest(GET,
>> endpoint).withHeaders(`Accept-Encoding`(gzip), Connection("Keep-Alive")) ~>
>> authorize
>
> log.info(s"Making request: $req")
>
> Source.single(req)
>
> .via(client)
>
> .runWith(Sink.head)
>
> .pipeTo(self)
>
> }
>
> }
>
>
As a result I'm getting an Http 404 response. This doesn't make much sense
to me as when I copy the full url to curl it just works
> curl --compressed -v -uuser:pass https://my.streaming.api.com/somepath
>
Also when I connect to a mock implementation of this streaming API using
Http protocol, my code works fine (using outgoingConnection instead of
outgoingConnectionTls).
What do I do wrong when making Https request? As far as I understand
changing to outgoingConnectionTls should be enough for most cases.
Any help is be 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 [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.