apache / camel-quarkus

Apache Camel Quarkus
https://camel.apache.org
Apache License 2.0
256 stars 189 forks source link

[Serialization] Hazelcast extension : using HazelcastSedaProducer with transferExchange=true #2101

Open zbendhiba opened 3 years ago

zbendhiba commented 3 years ago

On native mode, it's impossible use to write HazelcastSedaProducer with transferExchange=true. The reason is there an issue while writing object of type DefaultExchangeHolder. It's related to this issue graal#460

Also for integration tests for HazelcastAggregationRepository and ReplicatedHazelcastAggregationRepository, that use the same Serializable class object.

ppalaga commented 3 years ago

Support for JDK serialization/deserialization https://github.com/oracle/graal/pull/2730 was merged recently and should be delivered with GraalVM 21.0.0

zbendhiba commented 3 years ago

I'll add the integration test when we move to GraalVm 21.0.0

zbendhiba commented 3 years ago

Also add integration test for Query on Map, using a Serializable object.

lburgazzoli commented 3 years ago

@davsclaus I wonder if we should start a stream to investigate a pluggable strategy for this and other similar cases i.e. allowing to use json, protobuf & what not

davsclaus commented 3 years ago

The transferExchange is a bad design as it enforces to use Camel on both sides, and gives the impression that you can transfer the current state of the exchange to some cache / storage, and then retrieve it later, and then continue routing it.

Its for historical use we had it, and when Java objects wasn't yet a big big security vulnerability and warning.

Instead what is a more general concept would be to have an API for serializing / de-serializing a Camel message with its body and header (eg user payload) and not to include internal exchange state that may be stored as exchange properties and whatnot.

Such a API / contract can also be used by EIPs and components to store user payload more easily. And then we can have implementations for common types, such as you refer to with json/xml payloads. And for binary then avro/protobuf/what not

ppalaga commented 3 years ago

Blocked by https://github.com/quarkusio/quarkus/pull/15380

zbendhiba commented 3 years ago

The transferExchange is a bad design as it enforces to use Camel on both sides, and gives the impression that you can transfer the current state of the exchange to some cache / storage, and then retrieve it later, and then continue routing it.

Its for historical use we had it, and when Java objects wasn't yet a big big security vulnerability and warning.

Instead what is a more general concept would be to have an API for serializing / de-serializing a Camel message with its body and header (eg user payload) and not to include internal exchange state that may be stored as exchange properties and whatnot.

Such a API / contract can also be used by EIPs and components to store user payload more easily. And then we can have implementations for common types, such as you refer to with json/xml payloads. And for binary then avro/protobuf/what not

@davsclaus Maybe you should comment on this issue : https://issues.apache.org/jira/browse/CAMEL-16805. I'm not sure if I understood everything. Should we build something new, or should we change the transferExchange used in the HazelcastSedaProducer ?

davsclaus commented 3 years ago

OK added a comment in JIRA.

davsclaus commented 3 years ago

I think for now we should just NOT support transferExchange in the camel-hazelcast-extension.

Then that can be revisted later when CAMEL-16805 is implemented.