You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Hubertus.Willuhn" <hu...@dinsoftware.de> on 2016/02/09 15:14:10 UTC

LevelDB and Serializable Bug

Hi,

i am using the LevelDB repository of Camel to store exchange while
aggregating.

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

But Camel don't wont 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 and this function seems to be the
problem:

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

Why does this class do a check with the default java types?
In the official documentation of LevelDB (
http://camel.apache.org/leveldb.html <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. 

So my class got the signature:

public class ID implements Cloneable, Serializable {

and only 3 properties:

	private final String org;
	private final String type;
	private String key;

So it should be possible to store/restore this as header field?
Did i miss something here?

Thanks in advance.

Best regards,

Hubertus Willuhn



--
View this message in context: http://camel.465427.n5.nabble.com/LevelDB-and-Serializable-Bug-tp5777469.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: LevelDB and Serializable Bug

Posted by "Hubertus.Willuhn" <hu...@dinsoftware.de>.
Hi,

ok thanks for the response. I register and create a new JIRA for this
improvment:

https://issues.apache.org/jira/browse/CAMEL-9584
<https://issues.apache.org/jira/browse/CAMEL-9584>  

Best regards

Hubertus Willuhn



--
View this message in context: http://camel.465427.n5.nabble.com/LevelDB-and-Serializable-Bug-tp5777469p5777512.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: LevelDB and Serializable Bug

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah you are welcome to look into an improvement. We could add an
option to the level db repository to turn on serialized headers. And
then add such a flag to DefaultExchangeHolder.

You can log a ticket and see here how to contribute
http://camel.apache.org/contributing

On Tue, Feb 9, 2016 at 3:22 PM, Hubertus.Willuhn
<hu...@dinsoftware.de> wrote:
> Thanks for the answer (very fast).
>
> But that seems "incorrect"/"inconsistent" to me, because i can send my ID
> class in the header
> while routing with no problems...only the persistence seems be broken.
>
> I think that should be changed some how or is there a technical reason for
> this behavior?
>
> Is it possible to overwrite a camel component to to that?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/LevelDB-and-Serializable-Bug-tp5777469p5777471.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: LevelDB and Serializable Bug

Posted by "Hubertus.Willuhn" <hu...@dinsoftware.de>.
Thanks for the answer (very fast).

But that seems "incorrect"/"inconsistent" to me, because i can send my ID
class in the header
while routing with no problems...only the persistence seems be broken.

I think that should be changed some how or is there a technical reason for
this behavior?

Is it possible to overwrite a camel component to to that?



--
View this message in context: http://camel.465427.n5.nabble.com/LevelDB-and-Serializable-Bug-tp5777469p5777471.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: LevelDB and Serializable Bug

Posted by Claus Ibsen <cl...@gmail.com>.
Only the body can be binary objects / headers cannot.

On Tue, Feb 9, 2016 at 3:14 PM, Hubertus.Willuhn
<hu...@dinsoftware.de> wrote:
> Hi,
>
> i am using the LevelDB repository of Camel to store exchange while
> aggregating.
>
> Every exchange contains a simple POJO in the header that serves as
> aggregation predicate.
>
> But Camel don't wont 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 and this function seems to be the
> problem:
>
> protected static Object getValidHeaderValue(String headerName, Object
> headerValue) {
>
> Why does this class do a check with the default java types?
> In the official documentation of LevelDB (
> http://camel.apache.org/leveldb.html <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.
>
> So my class got the signature:
>
> public class ID implements Cloneable, Serializable {
>
> and only 3 properties:
>
>         private final String org;
>         private final String type;
>         private String key;
>
> So it should be possible to store/restore this as header field?
> Did i miss something here?
>
> Thanks in advance.
>
> Best regards,
>
> Hubertus Willuhn
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/LevelDB-and-Serializable-Bug-tp5777469.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2