Skip to content

camel-hazelcast: deprecate CamelHazelcastCacheType, which nothing sets or reads - #29959

Open
Dhairya-007 wants to merge 6 commits into
apache:mainfrom
Dhairya-007:fix/hazelcast-deprecate-cache-type-header
Open

Dhairya-007 wants to merge 6 commits into
apache:mainfrom
Dhairya-007:fix/hazelcast-deprecate-cache-type-header

Conversation

@Dhairya-007

Copy link
Copy Markdown
Contributor

Problem

HazelcastConstants documents a header for the multimap endpoint, right beside CamelHazelcastCacheName:

@Metadata(label = "consumer", description = "The name of the cache - e.g. \"foo\"", javaType = "String", applicableFor = {
        SCHEME_MULTIMAP, SCHEME_REPLICATED_MAP, SCHEME_LIST, SCHEME_QUEUE, SCHEME_SET, SCHEME_MAP, SCHEME_TOPIC })
public static final String CACHE_NAME = "CamelHazelcastCacheName";
@Metadata(description = "The type of the cache - here multimap", javaType = "String", applicableFor = SCHEME_MULTIMAP)
public static final String CACHE_TYPE = "CamelHazelcastCacheType";

Sitting next to the cache name, which the consumer really does set, "The type of the cache - here multimap" reads as something the consumer provides too. Nothing in the component sets it. The listener path sets four headers and this is not one of them:

public static void setListenerHeaders(Exchange ex, String listenerType, String listenerAction, String cacheName) {
    ex.getIn().setHeader(HazelcastConstants.CACHE_NAME, cacheName);
    HazelcastComponentHelper.setListenerHeaders(ex, listenerType, listenerAction);
}

public static void setListenerHeaders(Exchange ex, String listenerType, String listenerAction) {
    ex.getIn().setHeader(HazelcastConstants.LISTENER_ACTION, listenerAction);
    ex.getIn().setHeader(HazelcastConstants.LISTENER_TYPE, listenerType);
    ex.getIn().setHeader(HazelcastConstants.LISTENER_TIME, new Date().getTime());
}

No producer reads it either - CamelHazelcastCacheType appears nowhere in the component apart from its own declaration - so setting it changes nothing. It is the only header of the multimap endpoint with neither a label nor any code behind it.

Fix

Deprecate the constant with a deprecationNote saying what the listener does set, so the catalog stops listing it for hazelcast-multimap. The kind of cache is already in the endpoint scheme, and the sort of listener in CamelHazelcastListenerType.

The constant stays, so nothing stops compiling. The regenerated hazelcast-multimap.json files are included.

…s or reads

The header is documented for the multimap consumer, next to
CamelHazelcastCacheName, as "The type of the cache - here multimap". It
suggests the consumer tells the route what kind of cache the event came
from, but nothing in the component sets it - the listener path sets four
headers and this is not one of them:

    public static void setListenerHeaders(Exchange ex, String listenerType, String listenerAction, String cacheName) {
        ex.getIn().setHeader(HazelcastConstants.CACHE_NAME, cacheName);
        HazelcastComponentHelper.setListenerHeaders(ex, listenerType, listenerAction);
    }

    public static void setListenerHeaders(Exchange ex, String listenerType, String listenerAction) {
        ex.getIn().setHeader(HazelcastConstants.LISTENER_ACTION, listenerAction);
        ex.getIn().setHeader(HazelcastConstants.LISTENER_TYPE, listenerType);
        ex.getIn().setHeader(HazelcastConstants.LISTENER_TIME, new Date().getTime());
    }

and no producer reads it either, so setting it changes nothing.

Deprecate it with a note saying what the listener does set. The kind of
cache is already in the endpoint scheme, and the sort of listener in
CamelHazelcastListenerType.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. CACHE_TYPE/CamelHazelcastCacheType is verified unused — zero references outside its own declaration in HazelcastConstants.java. The @Metadata(deprecationNote=...) + @Deprecated pattern matches Camel's existing convention. Generated JSON is consistent with the annotation.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I checked CACHE_TYPE / CamelHazelcastCacheType against main: nothing in the repo sets or reads it, and it was not set in camel-2.25.x either, so deprecating it is right. The deprecationNote style matches the other components, and the two catalog JSON files are consistent.

  1. HazelcastMultimapEndpointBuilderFactory in dsl/camel-endpointdsl/src/generated/... also needs regenerating: the hazelcastCacheType() header method gets @Deprecated and the note, as InfluxDb2EndpointBuilderFactory did in #29709. Otherwise CI will likely report uncommitted changes.
  2. The hand-written consumer header tables still say the consumer sets it: hazelcast-map-component.adoc:368 ("the type of the cache (e.g., map)") and hazelcast-replicatedmap-component.adoc:228. Could we drop those rows too? Editing the adoc also means regenerating the copies under catalog/camel-catalog/src/generated/resources/.../docs/.
  3. Could we add a short entry to camel-4x-upgrade-guide-4_24.adoc, as #29709 did?

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ Generated files are up to date

An earlier CI run reported uncommitted generated changes; the latest run no longer does.

@github-actions github-actions Bot added the dsl label Nov 14, 2026

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the Regen commit added @Deprecated and the note to hazelcastCacheType() in HazelcastMultimapEndpointBuilderFactory, so the generated-files point is done. Two points are still open:

  1. The hand-written consumer header tables still say the consumer sets the header: components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc:368 and hazelcast-replicatedmap-component.adoc:228. Could we drop those two rows? Editing the adoc files also means regenerating their copies under catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/.
  2. Please add a short entry for the deprecated CamelHazelcastCacheType header to docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc, as #29709 did.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-hazelcast
  • docs
  • dsl/camel-endpointdsl

🔁 1 test passed only after a retry on JDK 21 (2 retried attempts)

Recovered flaky tests on JDK 21 (1)
Module Test Failed attempts First failure
dsl/camel-jbang/camel-jbang-plugin-tui AiPanelAcpTest.usageUpdateFeedsTheTokenCounter 2 1234 + the 66 this turn added ==> expected: <1300> but was: <1234>

ℹ️ These tests did not fail the build. Surefire retried them and they passed.
Retries are enabled project-wide by surefire.rerunFailingTestsCount in parent/pom.xml.


🔬 Scalpel shadow comparison — Scalpel: 9 of 726 tested, 24 compile-only — current: 9 all tested

Maveniverse Scalpel detected 9 affected modules (current approach: 9).

Skip-tests mode would test 9 modules (4 direct + 8 downstream), skip tests for 24 (generated code, meta-modules)

Modules Scalpel would test (9)
  • camel-hazelcast ← components/camel-hazelcast/src/generated/resources/META-INF/org/apache/camel/component/hazelcast/multimap/hazelcast-multimap.json, components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc, components/camel-hazelcast/src/main/docs/hazelcast-replicatedmap-component.adoc, components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastConstants.java
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-jbang-run ← downstream of org.apache.camel:camel-catalog
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
  • camel-yaml-dsl-validator ← downstream of org.apache.camel:camel-catalog
  • camel-yaml-dsl-validator-maven-plugin ← downstream of org.apache.camel:camel-yaml-dsl-validator
Modules with tests skipped (24)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (36 modules, 6m 45s total)

Total reactor time: 6m 45s

Module Duration Status
Camel :: JBang :: Plugin :: TUI 58.3s SUCCESS
Camel :: JBang :: MCP 57.0s SUCCESS
Camel :: JBang :: Run 34.6s SUCCESS
Camel :: YAML DSL :: Validator 30.7s SUCCESS
Camel :: JBang :: Plugin :: Validate 26.3s SUCCESS
Camel :: YAML DSL 22.3s SUCCESS
Camel :: Catalog :: Camel Catalog 22.2s SUCCESS
Camel :: Component DSL 20.8s SUCCESS
Camel :: Kamelet Main 17.3s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 16.5s SUCCESS
Camel :: JBang :: Plugin :: Testing 13.8s SUCCESS
Camel :: Docs 11.0s SUCCESS
Camel :: JBang :: Plugin :: Generate 9.9s SUCCESS
Camel :: Catalog :: Camel Route Parser 8.5s SUCCESS
Camel :: YAML DSL :: Deserializers 8.3s SUCCESS
Camel :: Catalog :: Camel Report Maven Plugin 7.0s SUCCESS
Camel :: Assembly 6.4s SUCCESS
Camel :: All Components Sync point 5.5s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 4.8s SUCCESS
Camel :: JBang :: Plugin :: MCP 4.8s SUCCESS
Camel :: JBang :: Plugin :: Edit 3.3s SUCCESS
Camel :: YAML DSL :: Maven Plugins 2.9s SUCCESS
Camel :: Catalog :: Maven 2.7s SUCCESS
Camel :: Coverage 2.2s SUCCESS
Camel :: Catalog :: Suggest (deprecated) 1.8s SUCCESS
Camel :: JBang :: Main 1.4s SUCCESS
Camel :: Catalog :: Dummy Component 1.1s SUCCESS
Camel :: JBang :: Integration tests 0.9s SUCCESS
Camel :: Catalog :: Console 0.8s SUCCESS
Camel :: Endpoint DSL :: Support 0.8s SUCCESS
Camel :: Launcher :: Container 0.7s SUCCESS
Camel :: Endpoint DSL n/a
Camel :: HazelCast n/a
Camel :: Integration Tests n/a
Camel :: JBang :: Core n/a
Camel :: Launcher n/a

Top 20 slowest modules:

  • Camel :: JBang :: Plugin :: TUI (58.3s)
  • Camel :: JBang :: MCP (57.0s)
  • Camel :: JBang :: Run (34.6s)
  • Camel :: YAML DSL :: Validator (30.7s)
  • Camel :: JBang :: Plugin :: Validate (26.3s)
  • Camel :: YAML DSL (22.3s)
  • Camel :: Catalog :: Camel Catalog (22.2s)
  • Camel :: Component DSL (20.8s)
  • Camel :: Kamelet Main (17.3s)
  • Camel :: JBang :: Plugin :: Kubernetes (16.5s)
  • Camel :: JBang :: Plugin :: Testing (13.8s)
  • Camel :: Docs (11.0s)
  • Camel :: JBang :: Plugin :: Generate (9.9s)
  • Camel :: Catalog :: Camel Route Parser (8.5s)
  • Camel :: YAML DSL :: Deserializers (8.3s)
  • Camel :: Catalog :: Camel Report Maven Plugin (7.0s)
  • Camel :: Assembly (6.4s)
  • Camel :: All Components Sync point (5.5s)
  • Camel :: YAML DSL :: Validator Maven Plugin (4.8s)
  • Camel :: JBang :: Plugin :: MCP (4.8s)

⚙️ View full build and test results

…, add an upgrade note

The hand-written consumer header tables of hazelcast-map and
hazelcast-replicatedmap still listed the header as something their
consumer sets. They do not: HazelcastComponentHelper.setListenerHeaders
sets the cache name, the listener type, the listener action and the
listener time, and nothing in the component sets or reads the cache
type. Dropped both rows, in src/main/docs and in the catalog copies.

Added a section to the 4.24 upgrade guide, as apache#29709 did for
camel-influxdb2.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Dhairya-007

Copy link
Copy Markdown
Contributor Author

Both done, thanks.

  1. Dropped the CamelHazelcastCacheType row from hazelcast-map-component.adoc:368 and hazelcast-replicatedmap-component.adoc:228, and from the two copies under catalog/camel-catalog/.../docs/; the four files diff clean against their mirrors. Both tables claimed their consumer sets the header, which no consumer does — HazelcastComponentHelper.setListenerHeaders sets CACHE_NAME, LISTENER_ACTION, LISTENER_TYPE and LISTENER_TIME.
  2. Added a === camel-hazelcast section to camel-4x-upgrade-guide-4_24.adoc in the shape camel-influxdb2: deprecate retentionPolicy, which has no effect #29709 used, with those two setListenerHeaders overloads quoted as the evidence and a note that nothing replaces the header.

# Conflicts:
#	docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@github-actions github-actions Bot added the docs label Nov 15, 2026

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Dhairya-007, both open points are done:

  • The CamelHazelcastCacheType rows are gone from the consumer header tables in hazelcast-map-component.adoc and hazelcast-replicatedmap-component.adoc, and the catalog copies match.
  • The upgrade guide has an entry for the deprecated header. Its claim holds: HazelcastComponentHelper.setListenerHeaders sets only the cache name, listener action, type and time, and nothing in the component refers to CACHE_TYPE.
  1. [Suggestion, optional] camel-4x-upgrade-guide-4_24.adoc:8903-8915: users who are migrating do not need the component's internal setListenerHeaders code. One sentence would do the same job, for example: "The consumers set CamelHazelcastCacheName, CamelHazelcastListenerAction, CamelHazelcastListenerType and CamelHazelcastListenerTime, never the cache type."

LGTM.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@davsclaus

Copy link
Copy Markdown
Contributor

Thanks @Dhairya-007, this is approved and ready to merge, but it now conflicts with main. #29954 (camel-docker deprecations) was merged and also adds a section at the end of docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc, and #29955, #29958 and #29959 each do the same. Could you rebase on main and keep both sections? Once one of the three is merged the next one conflicts again in the same place, so rebasing all three now and merging them one at a time may need another rebase in between.

Claude Code on behalf of davsclaus

@davsclaus

Copy link
Copy Markdown
Contributor

@Dhairya-007 thanks, this one is approved, but it now conflicts with main after today's merges of the other header PRs. Could you rebase it onto main, regenerate the generated files (catalog JSON and endpoint DSL), and force-push? We'll merge it once CI is green.

Claude Code on behalf of davsclaus

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on my earlier review — all prior findings remain addressed.

New commits (adoc removals, upgrade guide entry, generated file regen) are correct and consistent:

  • CamelHazelcastCacheType verified unused across the entire hazelcast component — setListenerHeaders never sets it; no consumer/producer reads it.
  • Adoc table removals are complete (hazelcast-map-component.adoc and hazelcast-replicatedmap-component.adoc).
  • Upgrade guide setListenerHeaders code snippet matches the actual source verbatim.
  • Catalog JSON files updated consistently in both source and catalog copy locations.

Needs a rebase on main due to conflict in camel-4x-upgrade-guide-4_24.adoc with other merged hazelcast header PRs (#29954, #29955, #29958). Once rebased, this is ready to merge.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@oscerd oscerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed the claim: CACHE_TYPE (CamelHazelcastCacheType) is neither set nor read anywhere in the hazelcast main sources, only declared in HazelcastConstants. It sits right next to CACHE_NAME, which does carry a value, so the multimap docs read as if both work when only one does.

Deprecating it with a deprecationNote and the upgrade-guide entry is the right call, and the regen of the multimap and replicated-map docs plus the component JSON is included, with CI green. Small, accurate cleanup.

Claude Code on behalf of oscerd

davsclaus and others added 2 commits November 16, 2026 11:23
Resolves the conflict with main in the 4.24 upgrade guide (both entries kept).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants