Pankaj Takawale created CAMEL-8864:
--------------------------------------
Summary: Camel-Aggregator JDBC repository always overwrites old
exchange
Key: CAMEL-8864
URL: https://issues.apache.org/jira/browse/CAMEL-8864
Project: Camel
Issue Type: Bug
Components: camel-sql
Affects Versions: 2.15.2
Reporter: Pankaj Takawale
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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)