camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ron Gavlin (JIRA)" <>
Subject [jira] Commented: (CAMEL-814) Provide Aggregation Strategy/Collection implementation(s) that can be used to replace smx-eip SplitterAggregator & RecipientListAggregator
Date Sat, 11 Oct 2008 03:09:53 GMT


Ron Gavlin commented on CAMEL-814:

Hi Claus,

The following servicemix-eip class is responsible for building aggregate messages for both
Splitters and RecipientLists. The buildAggregate() method listed below actually builds the
aggregate message. The two element names and attribute names used to build the aggregate message
are also listed below, each of which is customizable in a declarative fashion. It would be
ideal if folks upgrading from servicemix-eip to servicemix-camel were provided an out-of-the-box
aggregator strategy/collection that built aggregate messages using the same format. Existing
smx-eip customers have already built follow-on transforms that expect to find this format.

Let me know if you have further questions.


    protected QName aggregateElementName = new QName("aggregate");
    protected QName messageElementName = new QName("message");
    protected String countAttribute = "count";
    protected String indexAttribute = "index";

public void buildAggregate(Object aggregation, NormalizedMessage message, 
            MessageExchange exchange, boolean doTimeout) throws Exception {
        NormalizedMessage[] messages = ((SplitterAggregation) aggregation).messages;
        String correlationId = ((SplitterAggregation) aggregation).correlationId;
        SourceTransformer st = new SourceTransformer();
        Document doc = st.createDocument();
        Element root = createChildElement(aggregateElementName, doc);
        root.setAttribute(countAttribute, Integer.toString(messages.length));
        for (int i = 0; i < messages.length; i++) {
            if (messages[i] != null) {
                Element elem = st.toDOMElement(messages[i]);
                if (messageElementName != null) {
                    Element msg = createChildElement(messageElementName, root);
                    msg.setAttribute(indexAttribute, Integer.toString(i));
                    msg.appendChild(doc.importNode(elem, true));
                } else {
                    root.appendChild(doc.importNode(elem, true));
                if (isCopyProperties()) {
                    copyProperties(messages[i], message);
                if (isCopyAttachments()) {
                    copyAttachments(messages[i], message);
        message.setContent(new DOMSource(doc));
        message.setProperty(AbstractSplitter.SPLITTER_CORRID, correlationId);
    protected Element createChildElement(QName name, Node parent) {
        Document doc = parent instanceof Document ? (Document) parent : parent.getOwnerDocument();
        Element elem;
        if ("".equals(name.getNamespaceURI())) {
            elem = doc.createElement(name.getLocalPart());   
        } else {
            elem = doc.createElementNS(name.getNamespaceURI(),
                                       name.getPrefix() + ":" + name.getLocalPart());
        return elem;

> Provide Aggregation Strategy/Collection implementation(s) that can be used to replace
smx-eip SplitterAggregator & RecipientListAggregator
> ------------------------------------------------------------------------------------------------------------------------------------------
>                 Key: CAMEL-814
>                 URL:
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Ron Gavlin
> Users looking to upgrade from smx-eip to smx-camel should be provided an out-of-the-box
aggregator strategy/collection to replace the smx-eip SplitterAggregator & RecipientListAggregator.

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

View raw message