wso2 / wso2/api-platform

Handle gateway deletion when active WebSocket connections exist

Open
#69 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type/Task
Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Description

Determine and implement the appropriate behavior when deleting a gateway that has active WebSocket connections to the control plane. The system must handle these active connections gracefully, with two possible approaches to be decided.

Decision Required

Option 1: Block Deletion

  • Prevent deletion when active connections exist
  • Return HTTP 409 Conflict with connection count
  • Require connections to be closed before deletion

Option 2: Allow Deletion with Immediate Cleanup

  • Allow deletion even with active connections
  • Immediately drop all active WebSocket connections
  • Ensure connections are properly closed/terminated
  • Return HTTP 204 No Content after successful deletion and cleanup

Acceptance Criteria

Once approach is decided, implement the following:

  • Determine and document which approach to use (blocking vs. cleanup)
  • Implement chosen approach consistently
  • Active WebSocket connections are handled appropriately (blocked or dropped)
  • If connections are dropped, they are closed immediately and cleanly
  • Appropriate HTTP response returned (409 if blocked, 204 if allowed with cleanup)
  • Gateway instances are notified of deletion (if cleanup approach chosen)

Testing

Test Case 1: Gateway with active connections

  1. Create a gateway
  2. Establish one or more WebSocket connections from gateway to control plane
  3. Attempt to delete the gateway
  4. Verify behavior based on chosen approach:
    • If blocking: HTTP 409 Conflict response with connection count
    • If cleanup: HTTP 204 No Content, verify connections immediately dropped

Test Case 2: Gateway without active connections

  1. Create a gateway with no active connections (or close all connections)
  2. Attempt to delete the gateway
  3. Verify: HTTP 204 No Content (successful deletion)

Considerations

  • Connection lifecycle: How should gateway instances be notified if connections are dropped?
  • Graceful shutdown: Should there be a grace period or immediate termination?
  • Reconnection behavior: Dropped connections should not attempt to reconnect after deletion
  • Consistency: Behavior should align with overall system design and user expectations

Related

  • Related to: Issue #68 (API deployment validation)

Version

Platform API v1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the gateway deletion endpoint and active WebSocket connection lifecycle; the issue names no files or tests. Decide between blocking and cleanup, then add coverage for both connection states and verify the selected HTTP response and notification behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.