davsclaus opened a new pull request, #31098: URL: https://github.com/apache/camel/pull/31098
_Claude Code on behalf of davsclaus_ Fixes [CAMEL-27766](https://issues.apache.org/jira/browse/CAMEL-27766). ## Problem All 11 `KeyValueRepository` implementations put `@ManagedAttribute` on `int size()`. `size()` is not a Java bean getter, so `MBeanInfoAssembler` throws `IllegalArgumentException`. When a route calls a repository from a `bean` step, the repository becomes a mixin of the `ManagedBeanProcessor` MBean, so: - `JmxManagementLifecycleStrategy` logs a WARN with a stack trace (`Could not register service ... as Service MBean`) - the MBean of that step is not registered, so JMX has no statistics for the step and none of the repository's working operations (`get`, `put`, `delete`, `contains`, `clear`) ## Fix `size()` is now a `@ManagedOperation` in all implementations (Memory, Caffeine, Ehcache, JCache, Hazelcast, Infinispan remote, Redis, JDBC, JPA, Cassandra, Kafka). It is an operation rather than a `getSize()` attribute because in several stores counting is expensive (Redis scans the keys, Cassandra loads the keys, JDBC/JPA run a count query), and JMX consoles poll attributes. No new public methods, and no change to the SPI. The `ManagedAttribute` imports that became unused in Cassandra and Kafka are removed. No upgrade guide entry: the attribute never worked. ## Tests `ManagedMemoryKeyValueRepositoryTest` (camel-management) routes to `bean(repo, "size")` and checks that the step's MBean is registered and that the `InMemory` attribute and the `size`, `put` and `get` operations work. It fails without the fix ("The MBean of the bean step should be registered") and passes with it. The 10 component modules compile and are formatted. Target is 4.25.0 only, with no backport. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
