apache / apache/camel-quarkus

Starting a CamelMain instance from a function in kotlin (an AWS lambda handler)

Open
#1,478 10 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
302
Forks
232
Avg merge
1d 22h
Merged PRs (30d)
108

Description

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(input)
logger.info("input: {}", gson.toJson(inputObj))

val camelMain = CamelMainApplication()
camelMain.run()
logger.info("Ending Camel")
mapper.writeValue(output, HandlerOutput("Hello ${inputObj.who}"))
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The entry point shown is App.handler, which constructs and runs CamelMainApplication in a Kotlin AWS Lambda handler. Start by reproducing the null pointer exception during camelMain.run() and inspect CamelMainApplication startup in the Quarkus context. Done means the full Camel context starts and the handler completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java, kotlin
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.