--
>>>>>>>>>> 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+unsubscribe@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.
Hello,You could create a Directive1[UUID] which can then be used like this:
withRequestId { requestId =>pathSingleSlash {comlete(requestId.toString)}}Is that what you're looking for? See http://doc.akka.io/docs/akka-http/10.0.9/scala/http/routing-dsl/directives/custom-directives.html#directives-from-scratch for more details.Kind regards,Arnout
On Thu, Aug 24, 2017 at 1:55 AM, kraythe <kra...@gmail.com> wrote:
Greetings,I am currently using the low level API but lookign again at the DSL. I have been trying to figure out if there is a way to create a directive that creates a unique request UUID and allows other directives to access that UUID in every sub directive. Basically I want something likewithRequestId {requestId = UUID.randomUUID()pathSingleSlash {comlete(requestId.toString)}}I want this to be universal so the outer directive defines the id and the rest of the routes dont have to bother. I dont like copy past code. Any idea if and how this could be done?
--
>>>>>>>>>> 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.
Hello,You could create a Directive1[UUID] which can then be used like this:
withRequestId { requestId =>pathSingleSlash {comlete(requestId.toString)}}Is that what you're looking for? See http://doc.akka.io/docs/akka-http/10.0.9/scala/http/routing-dsl/directives/custom-directives.html#directives-from-scratch for more details.Kind regards,Arnout
On Thu, Aug 24, 2017 at 1:55 AM, kraythe <kra...@gmail.com> wrote:
Greetings,I am currently using the low level API but lookign again at the DSL. I have been trying to figure out if there is a way to create a directive that creates a unique request UUID and allows other directives to access that UUID in every sub directive. Basically I want something likewithRequestId {requestId = UUID.randomUUID()pathSingleSlash {comlete(requestId.toString)}}I want this to be universal so the outer directive defines the id and the rest of the routes dont have to bother. I dont like copy past code. Any idea if and how this could be done?
--
>>>>>>>>>> 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.
respondWithHeader(RawHeader("Request-ID", requestId)) {
pathPrefix(serviceConfig.getString("self.version")) {
extractClientIP { ip =>
def routes = {
extractUri { URI =>
val uri = URI.toString()
val requestId = Utils.generateRequestId()
respondWithHeader(RawHeader("Request-ID", requestId)) {
pathPrefix(serviceConfig.getString("self.version")) {
extractClientIP { ip =>
optionalHeaderValueByName("User-Agent") { agent =>
path("path") {
pathEnd {
get {