Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-15918

Create a new web API endpoint to stream events to SonarLint

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9.4
    • Component/s: Web API
    • Labels:
      None
    • Edition:
      Community
    • Production Notes:
      None

      Description

      The goal of this endpoint is to give SonarQube the possibility to push events to Sonarlint clients, to notify them about a change without delay. The solution is to use Server Side Event (SSE) over http1. Sonarlint clients will subscribe to events for a list of project keys & languages, the server should send an event when needed (see SONAR-15919 and SONAR-15920 as the first two events to be implemented) 

      Web API endpoint & parameters:

      api/sonarlint/streamEvents?projectKeys=key1,key2,key3&languages=java,python

      The endpoint should be flagged as internal.

      General payload used for all events:

      {
        event: EventName
        data: {-- event data payload as json here --}
      }

      Heartbeat:

      every 10s, the server will push a small payload to verify that the connexion is still alive. Any exception raised by this heartbeat will terminate the connexion on the server side.

      \r
      flush()
      \n
      flush()

      Authentication:

      The endpoint should support all current authentication mechanisms: JWT token, username:password, SQ token.

      Permission:

      Browse permission is required on all projects in the "projectKeys" parameter.

      DataCenter Edition implementation:

      Each Web node holds a local collection of Sonarlint Clients that are registered on this node (should be balanced by the load balancer). When an event is broadcast to SL clients, it's also sent to all SQ Web nodes through Hazelcast, allowing them to broadcast the event to their SL clients.

      Code design and packaging:

      This new endpoint and the related code should be placed in a dedicated module for ServerSide Event. It should be available starting from Community Edition, meaning it's open source.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lukasz.jarocki Łukasz Jarocki
              Reporter:
              pierre.guillot Pierre Guillot
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: