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

Christian Mueller commented on CAMEL-2367:
------------------------------------------

Starting yesterday, I'm thinking how camel and spring-batch could comes 
together and build some good integration. I have the following possibilities in 
my mind:

Camel could be used to schedule a job execution like in this way:
{code}
from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI")
.to(spring-batch://myScheduledJob?jobParameter1=value1);
{code}

Camel could be used to execute a job if an event occurs:
{code}
from("http://myCompany.com/someApp";)
  .choice()
    .when(header("foo").isEqualTo("bar"))
      .to(spring-batch://myFirstJob?jobParameter1=value1)
    .otherwise()
      .to(spring-batch://mySecondJob?jobParameter1=value1);
{code}

Another useful integration could be an ItemReader / ItemWriter integration 
which allows easily to use Camel routes to delegate the execution:
{code}
public class CamelItemReader implements ItemReader<Object> {
    
    private ConsumerTemplate template;

    public Object read() throws Exception, UnexpectedInputException, 
ParseException {
        Exchange exchange = template.receive("");

        Object answer = extractItem(exchange);
        
        return answer;
    }
}

public class CamelItemWriter implements ItemWriter<Object> {
    
    private ProducerTemplate template;

    public void write(List<? extends Object> objects) throws Exception {
        for (Object object : objects) {
            Exchange exchange = createExchange(object);
            
            template.send(exchange);
        }
    }
}
{code}

With the contribution from Tom, I think I have a good starting point for this 
new Camel component.

What do you think? Any remarks or other ideas? Or is this component/integration 
useless?

Regards,
Christian

> Spring-Batch integration with camel
> -----------------------------------
>
>                 Key: CAMEL-2367
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2367
>             Project: Apache Camel
>          Issue Type: New Feature
>         Environment: All
>            Reporter: Christian Mueller
>             Fix For: Future
>
>         Attachments: camelPOC.zip
>
>
> It would be nice, if we have an integration for Spring-Batch in Camel.
> See also 
> http://old.nabble.com/Spring-batch-integration-with-camel-ts25285268.html#a27179465
> Any already existing code which you could share with us?
> Any requirements / ideas / proposals for the integration?
> What should be the name? Only batch or spring-batch or something else?
> I'm looking forward for your posts...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to