Hubertus Willuhn created CAMEL-9584:
---------------------------------------

             Summary: LevelDB - Allow serializable objects in headers
                 Key: CAMEL-9584
                 URL: https://issues.apache.org/jira/browse/CAMEL-9584
             Project: Camel
          Issue Type: Improvement
          Components: camel-core, camel-leveldb
    Affects Versions: 2.16.1
         Environment: all platforms (linux and windows)
            Reporter: Hubertus Willuhn


I am using the LevelDB repository of Camel to store exchanges while aggregating.

Every exchange contains a simple POJO in the header that serves as aggregation 
predicate.

My POJO-class got the following signature:

{{public class ID implements Cloneable, Serializable { ...}}

and only 3 properties:

       {{private final String org;}}
       {{private final String type;}}
       {{private String key;}}

But Camel don't want to serialize my class because:

{{WARN  org.apache.camel.impl.DefaultExchangeHolder -- Exchange in headers 
containing key: RECID with object: CEN-PRJ-22 of type: com.domain.ID is not 
valid header type, it will be excluded by the holder.}}

I look into the "DefaultExchangeHolder" class and this function seems to be the 
problem:

{{protected static Object getValidHeaderValue(String headerName, Object 
headerValue) { ...}}

This function only allows default Java objects (like String).
*But it should be possible to persist any "Serializable".*

In the official documentation of LevelDB (http://camel.apache.org/leveldb.html) 
you can read:

LevelDBAggregationRepository will only preserve any Serializable compatible 
data types. If a data type is not such a type its dropped and a WARN is logged. 
And it only persists the Message body and the Message headers. The Exchange 
properties are not persisted.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to