Skip to content

[WebPubSub] Support invokeEvent for WebPubSub client#48316

Open
MoChilia wants to merge 10 commits intoAzure:mainfrom
MoChilia:invokeEvent
Open

[WebPubSub] Support invokeEvent for WebPubSub client#48316
MoChilia wants to merge 10 commits intoAzure:mainfrom
MoChilia:invokeEvent

Conversation

@MoChilia
Copy link
Member

@MoChilia MoChilia commented Mar 6, 2026

Description

Adds a preview request-response style invokeEvent API to the WebPubSub client, allowing users to invoke an upstream event and await a correlated response from the service.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@MoChilia MoChilia marked this pull request as ready for review March 9, 2026 05:59
Copilot AI review requested due to automatic review settings March 9, 2026 05:59
@MoChilia MoChilia requested a review from a team as a code owner March 9, 2026 05:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a preview, request/response-style upstream invocation API (invokeEvent) to the WebPubSub client, including new protocol frames, result/error models, and documentation/tests to support correlated invokeResponse handling.

Changes:

  • Introduces invokeEvent (sync) and supporting async implementation that awaits a correlated invokeResponse, plus cancelInvocation.
  • Adds new message models (invoke, invokeResponse, cancelInvocation) and wires them into encoding/decoding.
  • Adds tests and README/sample snippets demonstrating invocation scenarios (success/error/json/timeout/cancel).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sdk/webpubsub/azure-messaging-webpubsub-client/src/test/java/com/azure/messaging/webpubsub/client/InvokeEventTests.java Adds unit tests covering invoke success/error/json/timeout and cancelInvocation behavior.
sdk/webpubsub/azure-messaging-webpubsub-client/src/test/java/com/azure/messaging/webpubsub/client/DecoderTests.java Extends decoder tests to validate invokeResponse decoding for success/error/json payloads.
sdk/webpubsub/azure-messaging-webpubsub-client/src/samples/java/com/azure/messaging/webpubsub/client/ReadmeSamples.java Adds README sample methods for invokeEvent, timeout usage, and cancellation.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/models/InvokeEventResult.java Adds public model representing an invocation result payload.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/models/InvokeEventOptions.java Adds public options bag for invocationId/timeout configuration.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/models/InvocationException.java Adds public exception type for invocation failures/timeouts/service errors.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/implementation/models/WebPubSubMessage.java Registers new message types in the discriminator-based message factory.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/implementation/models/InvokeResponseMessage.java Implements invokeResponse frame serialization/deserialization.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/implementation/models/InvokeMessage.java Implements outbound invoke frame shape used by invokeEvent.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/implementation/models/CancelInvocationMessage.java Implements outbound cancelInvocation frame.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/implementation/MessageEncoder.java Ensures invoke frames have their payload normalized similarly to other outbound message types.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/WebPubSubClient.java Adds public sync invokeEvent overloads and cancelInvocation.
sdk/webpubsub/azure-messaging-webpubsub-client/src/main/java/com/azure/messaging/webpubsub/client/WebPubSubAsyncClient.java Adds internal reactive implementation for invoke/cancel and an InvokeResponseMessage sink.
sdk/webpubsub/azure-messaging-webpubsub-client/README.md Documents preview invoke/cancel APIs with code snippets.

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.

2 participants