dhimasya opened a new issue, #5306:
URL: https://github.com/apache/camel-quarkus/issues/5306

   ### Bug description
   
   hi, I'm really new to Camel-quarkus, just using it for around 6 months.
   It mainly uses camel-quarkus-javascript-dsl for route definition.
   
   could anyone help me figure out how to do it, 
   I see the sample in the docs that we can fetch the file and input stream, 
   but how to map it to the correct form parameter?
   
   here is what i do in js dsl:
   ```
   const Processor = Java.extend(Java.type("org.apache.camel.Processor"))
   
   
from("platform-http:/api/v1/upload?httpMethodRestrict=post&consumes=multipart/form-data")
   .process(new Processor(function(e) {
      var msg = 
e.getIn(Java.type("org.apache.camel.attachment.AttachmentMessage"))
      if (msg.hasAttachments()) {
         msg.getAttachments().forEach(row => {
            console.log(row)
            console.log(msg.getAttachmentObject(row))
            
console.log(msg.getAttachmentObject(row).getDataHandler().getContent())
         })
      }
      e.getIn().setBody("ok")
   }))
   ```
   I managed to do it using another camel component camel-netty, but i want to 
achieve it using platform-http as its not spawn separated HTTP services and its 
integration with Quarkus runtime:
   ```
   const Processor = Java.extend(Java.type("org.apache.camel.Processor"))
   
   from("netty-http:0.0.0.0:8082/api/v1/upload")
   .process(new Processor(function(e) {   
      const HttpPostRequestDecoder = 
Java.type("io.netty.handler.codec.http.multipart.HttpPostRequestDecoder")
      const NettyHttpMessage = 
Java.type("org.apache.camel.component.netty.http.NettyHttpMessage")
   
      var msg = e.getIn(NettyHttpMessage)
      var data = new HttpPostRequestDecoder(msg.getHttpRequest())
   
      console.log(data.getBodyHttpDatas())
      
      e.getIn().setBody("ok")
   }))
   ```
   when I try to cast the exchange message to nettyHttpMessage inside the 
platform-http processor it returns me null.
   
   thank you for the really good framework, I really enjoy writing many 
integration flows using 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.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org.apache.org

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

Reply via email to