You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/07/14 19:13:40 UTC

[GitHub] [camel-quarkus] gus-maurizio opened a new issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

gus-maurizio opened a new issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478


   Need to run a full camelcontext in Kotlin Quarkus from an AWS lambda handler routine. This is working fine in Java and Spring.
   I have a challenge starting the whole quarkus camel main. Any pointers? 
   Non working (null pointer exception) below:
   `
   package com.example
   
   import java.io.*
   import com.fasterxml.jackson.module.kotlin.*
   import org.slf4j.Logger
   import org.slf4j.LoggerFactory
   import com.google.gson.Gson
   import com.google.gson.GsonBuilder
   import org.apache.camel.quarkus.main.CamelMainApplication
   
   data class HandlerInput(val who: String)
   data class HandlerOutput(val message: String)
   
   class App {
       val mapper = jacksonObjectMapper()
       val logger: Logger = LoggerFactory.getLogger("com.example.App")
       val gson: Gson = GsonBuilder().setPrettyPrinting().create()
   
       fun handler(input: InputStream, output: OutputStream): Unit {
           val inputObj = mapper.readValue<HandlerInput>(input)
           logger.info("input: {}", gson.toJson(inputObj))
   
           val camelMain = CamelMainApplication()
           camelMain.run()
           logger.info("Ending Camel")
           mapper.writeValue(output, HandlerOutput("Hello ${inputObj.who}"))
       }
   }
   `


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] lburgazzoli commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686408196


   @gus-maurizio is [funqy](https://quarkus.io/guides/funqy) working for you ?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] davsclaus commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
davsclaus commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686457373


   Where do you get the NPE ?
   
   camel main can be configured to terminate after N period (idle, max messages etc)
   https://camel.apache.org/components/latest/others/main.html


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] gus-maurizio commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
gus-maurizio commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686470961


   That is a fair answer, and it would be very useful to have a better feature parity with Spring (and help reduce the number of vulnerabilities associated with spring…).
   
   > On Sep 3, 2020, at 8:55 AM, Luca Burgazzoli <no...@github.com> wrote:
   > 
   > 
   > Ok so I think we really need a proper support from funqy as for what I can understand, it is about to start Quarkus itself more than just camel.
   > 
   > Maybe something like https://quarkus.io/guides/command-mode-reference#main-method <https://quarkus.io/guides/command-mode-reference#main-method> which is very similar to the spring boot example could be used as an alternative but I never tested it.
   > 
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub <https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686469573>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKHJMNNFQQIS7C3TZQPMZK3SD6G4DANCNFSM4OZ2CHNQ>.
   > 
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] gus-maurizio commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
gus-maurizio commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686462236


   Answering both questions.
   
   - @lburgazzoli [here is code that does both Java and Spring](https://github.com/gus-maurizio/sam-camel.git). This is as much as I can share by company policies.
   - @davsclaus Indeed we leverage the wonderful self-termination features, both time running and number of messages/exchanges processed in Camel.
   
   While this would be enough for us to move forward, there is a simplicity and beauty to Quarkus that we would love to leverage. Also, we are considering moving away from Scala and Java to Kotlin (ah, the language wars never end...).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] lburgazzoli commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686469573


   Os so I think we really need a proper support from funqy as for what I can understand, it is about to start Quarkus itself more than just camel. 
   
   Maybe something like https://quarkus.io/guides/command-mode-reference#main-method which is very similar to the spring boot example could be used as an alternative but I never tested it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] gus-maurizio commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
gus-maurizio commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686455154


   I understand they are aware and it is a feature. The suggestion is to use (which we do) quarkus-lambda… to perform such functions.
   The only use case not completely covered in Quarkus (which it is in Spring Boot and plain java), is the ability to run (what we call) a Micro-Batch. This is basically a main class that will perform a function and then end gracefully (ideally within the max time limit allowed for a lambda, which is 15 minutes). The reason why we are so interested in this use case, is to avoid doing this in containers (for many reasons, before everybody starts throwing bricks, mostly related to governance and regulated industries reduction of blast radius and control surfaces).
   
   > On Sep 3, 2020, at 8:23 AM, Luca Burgazzoli <no...@github.com> wrote:
   > 
   > 
   > did you report the issue to the quarkus team ?
   > 
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub <https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686451883>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKHJMNMBPS2P5QRNXOXSVU3SD6DDNANCNFSM4OZ2CHNQ>.
   > 
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] gus-maurizio commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
gus-maurizio commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686444950


   Ciao Luca. It does for several use cases. For AWS Lambda, sadly, it does not allow access to the lambda context if your logic requires that. 
   
   G
   
   > On Sep 3, 2020, at 6:49 AM, Luca Burgazzoli <no...@github.com> wrote:
   > 
   > 
   > @gus-maurizio is funqy working for you ?
   > 
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub, or unsubscribe.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] lburgazzoli commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-660607517


   I think you may need something like [funqy](https://quarkus.io/guides/funqy) but I have not yet tested it with camel


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] lburgazzoli edited a comment on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
lburgazzoli edited a comment on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686469573


   Ok so I think we really need a proper support from funqy as for what I can understand, it is about to start Quarkus itself more than just camel. 
   
   Maybe something like https://quarkus.io/guides/command-mode-reference#main-method which is very similar to the spring boot example could be used as an alternative but I never tested it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] lburgazzoli commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686458057


   Do you have an example of doing it with plain java and spring ? I guess you'd need to use the command mode we recently introduced but would be nice to have an example so I can check if your use case is covered


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] lburgazzoli commented on issue #1478: Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1478:
URL: https://github.com/apache/camel-quarkus/issues/1478#issuecomment-686451883


   did you report the issue to the quarkus team ?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org