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

LevelDB - Allow serializable objects in headers

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.16.1
    • 2.17.0
    • camel-core, camel-leveldb
    • None
    • all platforms (linux and windows)

    Description

      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.

      Attachments

        Activity

          People

            acosentino Andrea Cosentino
            h.willuhn Hubertus Willuhn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: