Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement gateway events #363

Merged
merged 7 commits into from
Sep 7, 2023
Merged

Implement gateway events #363

merged 7 commits into from
Sep 7, 2023

Conversation

nicoloboschi
Copy link
Member

@nicoloboschi nicoloboschi commented Sep 6, 2023

Fixes #352

  • Moved the producer creation before the handshake response in the producer endpoint
  • Added a new event for client connected and disconnected
  • Added new field ´events-topic´ in the gateway which is the topic to write on the events

The write of the client connected event is sync and, in case of failures, will fail the handshake with the client. The event is sent BEFORE the handshake response to the client.

The event message is a JSON containing only the value (no key/headers). An example message is:

{
   "category":"Gateway",
   "type":"ClientConnected",
   "timestamp":1694004909662,
   "source":{
      "tenant":"tenant1",
      "applicationId":"application1",
      "gateway":{
         "events-topic":"topic2",
         "id":"consume",
         "type":"consume",
         "topic":"topic2",
         "authentication":null,
         "parameters":[
            "p"
         ],
         "produceOptions":null,
         "consumeOptions":null
      }
   },
   "data":{
      "userParameters":{
         "p":"consumer"
      },
      "options":{
      },
      "httpRequestHeaders":null
   }

Copy link
Member

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM

but I would move the api classes to ai.lanstream.api.events

* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ai.langstream.api.runner.topics.events;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

ai.langstream.api.events

@eolivelli eolivelli merged commit 12b74d1 into main Sep 7, 2023
8 checks passed
@cbornet cbornet deleted the gw-events branch September 7, 2023 09:36
benfrank241 pushed a commit to vectorize-io/langstream that referenced this pull request May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce events system backed by streaming topics
2 participants