camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boday <ben.o...@initekconsulting.com>
Subject RE: Complete exchange from file parsing before parsing complete
Date Thu, 09 Jun 2011 20:11:35 GMT
hey Joe, if you need to send out fragments as they are parsed, then you can
use a  http://camel.apache.org/producertemplate.html ProducerTemplate  from
your parser class (created from the exchange, etc)...

from("file:inbox")
  .bean(MyFileParser)

class MyFileParser {
  public void parse(Exchange exchange) {
    ProducerTemplate template =
exchange.getCamelContext().createProducerTemplate();
    while(<more data in file>) {
      String fragment = <get next fragment>;
      template.sendBody("activemq:queue:myQueue",fragment); 
    }
  }
}


Joe White-3 wrote:
> 
> In that setup wouldn't "MyFileParser" have to finish parsing before the
> split occurred?
> 
> I'd like to be able to multicast the objects out to queues as they are
> generated before the whole file is parsed in a spring configuration. In
> the example below Recon835Parser has code to publish to the dispatch
> queue.
> 
> Ideally I'd like to skip the remitDispatch queue since all it is doing
> is routing, but it I would prefer to be in spring not in Java. I could
> write the multicast into the parser which isn't a big deal but isn't
> ideal as my parser then has to be JMS aware.
> 
> 


-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/Complete-exchange-from-file-parsing-before-parsing-complete-tp4473282p4474112.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message