[akka-user] [akka-http] adding cookie attributes

2017-08-14 Thread Christophe Pache
Hello everyone!

I'm trying to add a sameSite attribute to cookies using the scaladsl and it 
looks like the Cookie API is quite closed. What I would like to do is 
something like 
`Set-Cookie: key=value; HttpOnly; SameSite=strict`
My feeling is that the only current way to do so is to craft a header with 
something like 
`RawHeader("Set-Cookie", "key=value; HttpOnly; SameSite=strict")`
If so, what about adding attributes to cookie header?

Thanks for any comment on that! Have a nice akking day!
Christophe

-- 
>>  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] Akka HTTP usage of HttpEntity.toStrict

2017-08-14 Thread Yannick Lazzari
Hi,

There is an opened ticket in akka-http regarding exceptions being thrown 
after using HttpEntity.toStrict: 
https://github.com/akka/akka-http/issues/1177.

My question is regarding Johannes Rudolph's comment about it being a 
workaround:

Using toStrictEntity is basically only a workaround and not a solution 
> because it will mean that all entity data will be buffered in memory which 
> means that your server will need more memory per concurrent request than 
> necessary.


Let's say you have the need to log the complete request payload of all 
requests coming in to a service. If you want to allow the logging logic to 
fully consume to request payload and still allow the entity to be 
unmarshalled to the desired object later on, what would be another way to 
ensure this never fails other than using toStrict, forcing the entire 
payload into memory and allowing it to be consumed more than once?

For example, consider the following route:


val route = extractExecutionContext & extractMaterializer & extractLog { 
(ec, mat, log) =>
  logRequest(LoggingMagnet(_ => logRequestDetails(_)(ec, mat, log))) {
path("someapi") {
  post {
entity(as[SomeInputClass]) { input =>
  // do something with input
}
  }
} 
  }
}

def logRequestDetails(req: HttpRequest)(implicit ec: ExecutionContext, 
materializer: Materializer, log: LoggingAdapter): Unit =
  Unmarshal(req.entity).to[String].map(b => s"The request body is 
$b").onComplete {
case Success(s) => log.info(s)
case Failure(e) => log.error(e, "Error")
  }


This is obviously a contrived example, but this logs the request body. It 
works, but we've seen such a pattern inconsistently yield 
java.lang.IllegalStateException: 
Substream Source cannot be materialized more than once errors. Isn't this a 
case where converting to a strict entity the correct way to address such 
problems, i.e. allow the request entity to be consumed more than once? If 
not, what would be the correct way?

Thanks for any insight you might have!

Yannick

-- 
>>  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] Re: [akka-http] Http().superPool() and MergeHub.source backpressure

2017-08-14 Thread Jeff
Quickly following up on this. My understanding of how MergeHub works leads 
me to believe that all 100 requests in my example should fire, however only 
8 of them do, and only 4 complete. 

On Wednesday, August 9, 2017 at 4:53:18 PM UTC-7, Jeff wrote:
>
> I am getting behavior that I do not  understand combining 
> Http().superPool() with MergeHub.source. Here is a sample application
>
> import akka.actor.ActorSystem
> import akka.http.scaladsl.Http
> import akka.http.scaladsl.model.{HttpRequest, Uri}
> import akka.stream.{ActorMaterializer, ThrottleMode}
> import akka.stream.scaladsl.{MergeHub, Sink, Source}
> import com.typesafe.config.ConfigFactory
>
> import scala.concurrent.duration._
>
> object Main extends App {
>   val config = ConfigFactory.load()
>
>   implicit val system = ActorSystem("test-system", config)
>   implicit val executionContext = system.dispatcher
>   implicit val materializer = ActorMaterializer()
>
>   val request = HttpRequest(uri = Uri("http://www.google.com";))
>
>   val sink = MergeHub.source[(HttpRequest, Int)]
> .throttle(1, 1.second, 1, ThrottleMode.shaping)
> .map { x =>
>   println(s"started ${x._2}")
>   x
> }
> .via(Http().superPool())
> .to(Sink.foreach { x =>
>   println(s"finished ${x._2}")
> }).run()
>
>   for (x <- 1 to 100) sink.runWith(Source.single(request -> x))
> }
>
>
> The output of which is 
>
> started 2
> finished 2
> started 3
> finished 3
> started 4
> finished 4
> started 1
> finished 1
> started 5
> started 6
> started 7
> started 8
>
> My understanding from the documentation is that Http().superPool() will 
> backpressure. However, after 8 iterations, nothing else happens. Thoughts?
>
> Thanks
> Jeff
>

-- 
>>  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] Akka cluster on Hadoop YARN

2017-08-14 Thread Juan Rodríguez Hortalá
Hi all, 
 
In a previous thread (
https://groups.google.com/forum/#!searchin/akka-user/yarn%7Csort:relevance/akka-user/ylV2tD5uuq8/8c3EN69ehrwJ)
 
there was a discussion about running Akka cluster on top of YARN. That 
thread is quite old, and has been inactive for some years. Do you know if 
someone has made progress with that?
 
Thanks, 
 
Juan 

-- 
>>  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 cluster on Hadoop YARN

2017-08-14 Thread Konrad “ktoso” Malawski
There has not been much interest in that from what I can cell.
Rather people are using k8s, marathon/mesos etc to run Akka applications
nowadays.

—
Konrad `kto.so` Malawski
Akka  @ Lightbend 

On 15 August 2017 at 12:03:14, Juan Rodríguez Hortalá (
juan.rodriguez.hort...@gmail.com) wrote:

Hi all,

In a previous thread (
https://groups.google.com/forum/#!searchin/akka-user/yarn%7Csort:relevance/akka-user/ylV2tD5uuq8/8c3EN69ehrwJ)
there was a discussion about running Akka cluster on top of YARN. That
thread is quite old, and has been inactive for some years. Do you know if
someone has made progress with that?

Thanks,

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