This is what I have tested successfully
import java.util.ArrayList;
import java.util.List;
import org.apache.camel.Consume;
public class ReportingConsumer {
private List result = new ArrayList();
@Consume(ref = "queueReportingEndpoint")
public List collectMessages(List received) {
if (received != null) {
// Only pickup from the received list the first object (= Map of
Audit messages)
// and add it to List that we will send as result to the next
endpoint
result.add(received.get(0));
}
return result;
}
}
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer
*****************************
blog : http://cmoulliard.blogspot.com
On Wed, Sep 16, 2009 at 11:24 AM, Claus Ibsen <[email protected]> wrote:
> On Wed, Sep 16, 2009 at 10:38 AM, Charles Moulliard
> <[email protected]> wrote:
> > Hi,
> >
> > I will implement a bean component who will play the role of a
> > pollingConsumer. This bean will be called every x minutes from a quartz
> > endpoint. This bean component will read all messages posted in a queue
> until
> > the last one and create a list of objects who will be used next by
> marshal
> > function defined in the camel route.
> >
> > Question : Can the method called in my "polling consumer" bean return a
> list
> > of objects or should it be defined as void ?
> >
>
> You can return whatever you like from the bean, and its output will be
> used as payload for the camel message.
>
> from(quartz).beanRef("myBeanThatIsAPollingConsumer").marshal()
>
>
>
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>