diff --git a/packages/hawtio/src/plugins/camel/camel-service.ts b/packages/hawtio/src/plugins/camel/camel-service.ts index b54a4d01b..33e2a383d 100644 --- a/packages/hawtio/src/plugins/camel/camel-service.ts +++ b/packages/hawtio/src/plugins/camel/camel-service.ts @@ -5,6 +5,7 @@ import { MBeanNode } from '@hawtiosrc/plugins/shared' import { jolokiaService } from '@hawtiosrc/plugins/shared/jolokia-service' import { isObject } from '@hawtiosrc/util/objects' import { isBlank } from '@hawtiosrc/util/strings' +import { debugService } from './debug' import { ENDPOINT_OPERATIONS } from './endpoints/endpoints-service' import { componentNodeType, @@ -261,7 +262,7 @@ export function canGetBreakpoints(node: MBeanNode): boolean { if (!isRouteNode(node)) return false const db = findDebugBean(node) - return db?.hasInvokeRights('getBreakpoints') ?? false + return db?.hasInvokeRights(debugService.getBreakpointsOperation(node)) ?? false } export function canTrace(node: MBeanNode): boolean { @@ -357,7 +358,7 @@ export function compareVersions(version: string, major: number, minor: number): * @param major major version as number * @param minor minor version as number */ -export function isCamelVersionEQGT(node: MBeanNode, major: number, minor: number) { +export function isCamelVersionEQGT(node: MBeanNode, major: number, minor: number): boolean { const camelVersion = getCamelVersion(node) if (!camelVersion) { return false diff --git a/packages/hawtio/src/plugins/camel/debug/debug-service.ts b/packages/hawtio/src/plugins/camel/debug/debug-service.ts index 53cf43e3a..4c68d25e9 100644 --- a/packages/hawtio/src/plugins/camel/debug/debug-service.ts +++ b/packages/hawtio/src/plugins/camel/debug/debug-service.ts @@ -70,11 +70,19 @@ class DebugService { return await this.isDebugging(node) } + /** + * Returns the name of operation for getting all the breakpoints on the BacklogDebugger + * MBean. The operation name differs between Camel v3 and v4. + */ + getBreakpointsOperation(node: MBeanNode): string { + return camelService.isCamelVersionEQGT(node, 4, 0) ? 'breakpoints' : 'getBreakpoints' + } + async getBreakpoints(node: MBeanNode): Promise { const db = this.getDebugBean(node) if (!db || !db.objectName) return [] - const result = await jolokiaService.execute(db.objectName, 'getBreakpoints') + const result = await jolokiaService.execute(db.objectName, this.getBreakpointsOperation(node)) return result as string[] }