Skip to content

Commit cc3ea0e

Browse files
clebertsuconicbrusdev
authored andcommitted
ARTEMIS-6165 start/stop button on lock coordinators
co-authored with Claude
1 parent 12da196 commit cc3ea0e

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

‎artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-service.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ const CLOSE_CONNECTION_SIG = "closeConnectionWithID(java.lang.String)";
180180
const CLOSE_SESSION_SIG = "closeSessionWithID(java.lang.String,java.lang.String)";
181181
const CLOSE_CONSUMER_SIG = "closeConsumerWithID(java.lang.String,java.lang.String)";
182182
const LIST_LOCK_MANAGER_SIG = "listLockCoordinatorsAsJSON()";
183+
const START_LOCK_COORDINATOR_SIG = "startLockCoordinator(java.lang.String)";
184+
const STOP_LOCK_COORDINATOR_SIG = "stopLockCoordinator(java.lang.String)";
183185

184186
const MS_PER_SEC = 1000;
185187
const MS_PER_MIN = 60 * MS_PER_SEC;
@@ -654,6 +656,14 @@ class ArtemisService {
654656
return jolokiaService.execute(await this.getBrokerObjectName(), CLOSE_CONSUMER_SIG, [session, name]);
655657
}
656658

659+
async startLockCoordinator(name: string) {
660+
return jolokiaService.execute(await this.getBrokerObjectName(), START_LOCK_COORDINATOR_SIG, [name]);
661+
}
662+
663+
async stopLockCoordinator(name: string) {
664+
return jolokiaService.execute(await this.getBrokerObjectName(), STOP_LOCK_COORDINATOR_SIG, [name]);
665+
}
666+
657667
async getBrokerObjectName() {
658668
return await this.brokerObjectName;
659669
}

‎artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/status/Status.tsx‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,41 @@ export const Status: React.FunctionComponent = () => {
297297
<Th>Name</Th>
298298
<Th>ID</Th>
299299
<Th>Status</Th>
300+
<Th></Th>
300301
</Tr>
301302
</Thead>
302303
<Tbody>
303304
{
304305
lockCoordinators?.lockCoordinators.map((coordinator, index) => {
305-
return <Tr>
306+
return <Tr key={index}>
306307
<Td>{coordinator.name}</Td>
307308
<Td>{coordinator.lockId}</Td>
308309
<Td>{coordinator.status}</Td>
310+
<Td>
311+
{coordinator.status === 'Stopped' ? (
312+
<Button variant="primary" size="sm" onClick={() => {
313+
artemisService.startLockCoordinator(coordinator.name)
314+
.then(() => {
315+
eventService.notify({ type: 'success', message: 'Lock Coordinator ' + coordinator.name + ' started', duration: 3000 });
316+
getLockCoordinators();
317+
})
318+
.catch((error) => {
319+
eventService.notify({ type: 'danger', message: 'Failed to start Lock Coordinator: ' + jolokiaService.errorMessage(error) });
320+
});
321+
}}>Start</Button>
322+
) : (
323+
<Button variant="secondary" size="sm" onClick={() => {
324+
artemisService.stopLockCoordinator(coordinator.name)
325+
.then(() => {
326+
eventService.notify({ type: 'success', message: 'Lock Coordinator ' + coordinator.name + ' stopped', duration: 3000 });
327+
getLockCoordinators();
328+
})
329+
.catch((error) => {
330+
eventService.notify({ type: 'danger', message: 'Failed to stop Lock Coordinator: ' + jolokiaService.errorMessage(error) });
331+
});
332+
}}>Stop</Button>
333+
)}
334+
</Td>
309335
</Tr>
310336
})
311337
}

0 commit comments

Comments
 (0)