title: Write to s3 from blocking queue java using camel
body: <p>I have a use case where I want to write in memory Java blocking queue contents using apache camel route to S3. Is this even possible??</p>
  <p>The workaround I can think of is to pull records from blocking queue and flush to local file and then to S3 via file-s3 route.</p>
  <p>Update:</p>
  <p>Route :</p>
  <pre><code>    fromF(&quot;seda:awsquue?concurrentConsumers=3&amp;queue=#NonLimitQueue%s&quot;, getSourceId())
      .convertBodyTo(byte[].class)
      .setHeader(S3Constants.CONTENT_LENGTH, simple(&quot;${in.header.CamelFileLength}&quot;))
      .setHeader(S3Constants.KEY,simple(&quot;${in.header.CamelFileNameOnly}&quot;))
      .log(LoggingLevel.INFO, &quot;route started&quot;)
      .to(&quot;aws-s3://&quot; +&quot;bucket&quot;
      + &quot;?amazonS3Client=#s3ClientProfiler&amp;serverSideEncryption=AES256&amp;multiPartUpload=true&quot;);
  </code></pre>
  <p>Queue creation in different workflow :</p>
  <pre><code>        context.registerBean(&quot;NonLimitQueue&quot;+sourceId,ArrayBlockingQueue.class, () -&gt; queue);
  </code></pre>
  <pre><code>camelContext.addRoutes(new S3RouteBuilder(sourceId));
              queue.add(&quot;qqqq&quot;);
  </code></pre>
  <p>When route starts it fails with exception :</p>
  <pre><code>java.lang.ClassCastException: class java.lang.String cannot be cast to class org.apache.camel.Exchange (java.lang.String is in module java.base of loader 'bootstrap'; org.apache.camel.Exchange is in unnamed module of loader 'app')
      at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:171)
      at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:125)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>
  <p>which I believe is failing at queue.add(&quot;qqqq&quot;). How to write to queue explicitly is not clear to me.</p>