aldettinger commented on issue #1475:
URL: https://github.com/apache/camel-quarkus/issues/1475#issuecomment-672971860


   Hi @dhanendras, and thanks for sharing you experience with camel-quarkus. I 
agree with Luca's view on this ticket.
   I played a bit with a route like:
   ```
   
rest().post("/submitodc").consumes(MediaType.MULTIPART_FORM_DATA).to("direct:uploadReportProcessor");
   from("direct:uploadReportProcessor").process(e -> 
e.getMessage().setBody(Map.of("name", "e")));
   ```
   And indeed, we hit an issue as there are no pre-registered 
[converters](https://camel.apache.org/manual/latest/type-converter.html) to 
translate a `Map` to a `ByteBuffer`.
   
   In such situation, one may end up using 
[camel-quarkus-gson](https://camel.apache.org/camel-quarkus/latest/extensions/gson.html)
 as below:
   ```
   process(...).marshal().json(JsonLibrary.Gson);
   ```
   
   Or maybe a [custom 
converter](https://camel.apache.org/manual/latest/type-converter.html#TypeConverter-Addtypeconverterclassesatruntime)
 similar to this:
   ```
   public void configure() {
     getContext().getTypeConverterRegistry().addTypeConverters(new 
MyCustomConverters());
     ...
   }
   
   @Converter
   public static class MyCustomConverters implements TypeConverters {
     @Converter
     public ByteBuffer toByteBuffer(HashMap<?, ?> map) {
       return ByteBuffer.wrap(...);
     }
   }
   ```
   Does it make sense 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:
us...@infra.apache.org


Reply via email to