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

Henryk Konsek commented on CAMEL-5408:
--------------------------------------

What about making CdiEventConsumer an asynchronous one? You could do this in 
Consumer processor's setter (as I correctly understand how CDI works).

I'd be something like:

private AsyncProcessor processor;

public void setProcessor(Processor processor) {
  this.processor = AsyncProcessorConverterHelper.convert(processor);
}

private void handleEvent(Object event) throws Exception {
  if (isStarted()) {
    Exchange exchange = endpoint.createExchange();
    exchange.getIn().setBody(event);
    processor.process(exchange, new AsyncCallback() {
                @Override
                public void done(boolean doneSync) {
                    // noop
                }
    });
  } else {
     logger.warn("Camel received event before starting the consumer. Event {} 
will be ignored", event);
  }
}
                
> Extend CDI component with support for events
> --------------------------------------------
>
>                 Key: CAMEL-5408
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5408
>             Project: Camel
>          Issue Type: New Feature
>            Reporter: Ɓukasz Dywicki
>         Attachments: CAMEL-5408-2.patch, CAMEL-5408.patch
>
>
> Camel-cdi integration allows to use beans registered in CDI registry. CDI 
> supports also event mechanism which can be useful in many cases. Provided 
> patch allows camel produce new CDI events.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to