Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8864

Camel-Aggregator JDBC repository always overwrites old exchange

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.15.2
    • Fix Version/s: 2.16.0
    • Component/s: camel-sql
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I'm using FlexibleAggregationStrategy to aggregate objects into collection. I found following issue where Aggregator ends up overwriting old collection with the new one.

      JdbcCamelCodec is not marshaling all of the exchange properties.
      E.g. it does not marshal exchange's 'CamelFlexAggrStrCollectionGuard' property.
      So next time Aggregator tries to fetch BLOB from database, oldExchange does not have above property.
      So following code creates new collection for each new object, and hence overwrites the old collection.
      private Collection<E> FlexibleAggregationStrategy::safeInsertIntoCollection(Exchange oldExchange, Collection<E> oldValue, E toInsert) {
      Collection<E> collection = null;
      try {
      if (oldValue == null || oldExchange.getProperty(COLLECTION_AGGR_GUARD_PROPERTY, Boolean.class) == null) {
      try {
      collection = collectionType.newInstance(); //**EVERYTIME NEW COLLECTION as previous aggregation did not serialize COLLECTION_AGGR_GUARD_PROPERTY to database.

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              pankajtakawale Pankaj Takawale
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: