You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Michael Genereux (Jira)" <ji...@apache.org> on 2020/08/14 20:01:00 UTC

[jira] [Commented] (CAMEL-15412) camel-box - No way to set OutputStream option

    [ https://issues.apache.org/jira/browse/CAMEL-15412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17178039#comment-17178039 ] 

Michael Genereux commented on CAMEL-15412:
------------------------------------------

Here's the workaround. I hope it's right.
{code:scala}
object BoxRouteBuilder extends RouteBuilder() {

  override def configure(): Unit = {
    from(timer("box_start")
    .process(new Processor {
      override def process(exchange: Exchange): Unit = {
        val message = exchange.getMessage()
        message
          .setHeader("CamelBox.fileId", "12345678")
        exchange.getMessage()
          .setHeader("CamelBox.output", stream)
      }
    })
    .to("box:files/download")
    .to(kafka("box_file_list")
  }

}
{code}
 

> camel-box - No way to set OutputStream option
> ---------------------------------------------
>
>                 Key: CAMEL-15412
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15412
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-box
>    Affects Versions: 3.4.2
>            Reporter: Michael Genereux
>            Priority: Major
>
> I want to download a file from Box and the setHeader doesn't accept objects when setting the header.  The required output parameter is a OutputStream. The integration tests use the component directly as opposed to the URLs or setHeader methods. I would have expected the outputstream payload to be in the Message coming out of the endpoint.  The REST component documentation looks more like what I was expecting.
> My variation of the example from the docs that doesn't work:
> {code:java}
> from("timer:test?period=3600")
>     .setHeader("CamelBox.fileId", constant("12345678")
>     .setHeader("CamelBox.output", new ByteArrayOutputStream())
>     .to("box://files/download")
>     .to("file://out");
> {code}
> Using Camel thinking, I tried this code first but I understand if this component wants to be special with its headers and stuff.
> {code:java}
> from("timer:test?period=3600")
>    .to("box://files/download?fileId=123456789") 
>    .to("file://out");  
> {code}
> Again, please let me know what I can do to help.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)