Conversation
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-storage-queue</artifactId> | ||
| <version>12.8.0</version> | ||
| <scope>test</scope> | ||
| </dependency> |
There was a problem hiding this comment.
This dependency should be removed.
There was a problem hiding this comment.
this is test scope for a sample. The released SDK won't have it.
...ntgrid/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/CloudEvent.java
Outdated
Show resolved
Hide resolved
...ntgrid/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/CloudEvent.java
Outdated
Show resolved
Hide resolved
...ntgrid/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/CloudEvent.java
Outdated
Show resolved
Hide resolved
...e-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/EventGridDeserializer.java
Outdated
Show resolved
Hide resolved
...id/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/EventGridEvent.java
Outdated
Show resolved
Hide resolved
...id/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/EventGridEvent.java
Outdated
Show resolved
Hide resolved
...e-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/EventGridSasGenerator.java
Outdated
Show resolved
Hide resolved
...ng-eventgrid/src/samples/java/com/azure/messaging/eventgrid/samples/ProcessSystemEvents.java
Outdated
Show resolved
Hide resolved
|
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
| * @param data the payload of this event. Set to null if your event doesn't have the data payload. | ||
| * It will be serialized as a String if it's a String, or application/json if it's not a String. | ||
| */ | ||
| public CloudEvent(String source, String type, Object data) { |
There was a problem hiding this comment.
Can CloudEvent have no data ? If data is optional, why it is provided in constructor ? User can call setData() if they need to. constructor are normally used for required parameters.
Also Add @throws clause , since it will throw IllegalArgumentException. After that you do not need to additionally explain It can't be null or empty .
There was a problem hiding this comment.
Yes a CloudEvent can have no data. This sounds weird but the specification says it's optional.
We still put it in the constructor because we believe 99% of the time a CloudEvent will have data.
| */ | ||
| public CloudEvent(String source, String type) { | ||
| public CloudEvent(String source, String type, byte[] data, String dataContentType) { | ||
| this(source, type); |
There was a problem hiding this comment.
null check for data and dataContentType ?
There was a problem hiding this comment.
Both data and dataContentType can be null.
...ntgrid/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/CloudEvent.java
Show resolved
Hide resolved
| * @param source a URI identifying the origin of the event. | ||
| * @param type the type of event, e.g. "Contoso.Items.ItemReceived". | ||
| * @param data the payload in bytes of this event. It will be serialized to Base64 format. | ||
| * @param dataContentType the type of the data. |
| } else if (CoreUtils.isNullOrEmpty(type)) { | ||
| } | ||
| if (CoreUtils.isNullOrEmpty(type)) { | ||
| throw logger.logExceptionAsError(new IllegalArgumentException("type cannot be null or empty")); |
There was a problem hiding this comment.
nit: casing, t in type should be capitol Type can not be null or empty.
There was a problem hiding this comment.
I changed to 'type' because the param name is type.
...id/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/EventGridEvent.java
Show resolved
Hide resolved
...ing-eventgrid/src/main/java/com/azure/messaging/eventgrid/EventGridPublisherAsyncClient.java
Show resolved
Hide resolved
...ing-eventgrid/src/main/java/com/azure/messaging/eventgrid/EventGridPublisherAsyncClient.java
Show resolved
Hide resolved
| return Flux.fromIterable(events) | ||
| .map(EventGridEvent::toImpl) | ||
| .map(event -> { | ||
| com.azure.messaging.eventgrid.implementation.models.EventGridEvent internalEvent = event.toImpl(); |
There was a problem hiding this comment.
This logic is at two places (also at line 121) Can we combine it in a function ?
There was a problem hiding this comment.
They look the same but one is for EventGridEvent and one for CloudEvent. the two classes don't have a common parent class or interface so I prefer not combining these lines of code.
Good points though.
...essaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/EventGridPublisherClient.java
Show resolved
Hide resolved
srnagar
left a comment
There was a problem hiding this comment.
Overall, looks good. A few minor comments. Just do another pass on improving the javadocs.
| * The CloudEvent model. This represents a cloud event as specified by the | ||
| * <a href="https://github.com/cloudevents/spec/blob/v1.0.1/spec.md">Cloud Native Computing Foundation</a> | ||
| * | ||
| * When you send a CloudEvent to an Event Grid Topic, the topic must be configured to receive the CloudEvent schema. |
There was a problem hiding this comment.
When this is moved to azure-core, we should update this doc to remove Event Grid specific details.
| * | ||
| * @throws IllegalArgumentException if subject, eventType or data is {@code null} or empty. | ||
| */ | ||
| public EventGridEvent(String subject, String eventType, Object data, String dataVersion) { |
There was a problem hiding this comment.
Since subject, eventType and dataVersion are required, I would put them as the first 3 params and move data to the end.
There was a problem hiding this comment.
I'll need to check with service team why data is optional and dataVersion is mandatory after beta4.
Added to follow-up issue #19014
| @@ -68,19 +72,28 @@ public EventGridServiceVersion getServiceVersion() { | |||
| * @param events the EventGrid events to publish. | |||
| * | |||
| * @return the completion. | |||
There was a problem hiding this comment.
Update this doc - A {@link Mono} that completes when the events are sent to the service.
There was a problem hiding this comment.
Thanks for the suggestion. Updated
|
|
||
| package com.azure.messaging.eventgrid.samples.models; | ||
|
|
||
| public class User { |
There was a problem hiding this comment.
Since this is in samples and users would look at this, we should have javadocs here.
There was a problem hiding this comment.
Added a javadoc for the class
|
|
||
| /** | ||
| * This sample code shows how to send {@link EventGridEvent}s to an Event Grid Topic that accepts Event Grid event schema. | ||
| * Refer to https://docs.microsoft.com/en-us/azure/event-grid/event-schema. |
| * | ||
| * For new customers, {@link CloudEvent} is generally preferred over EventGridEvent because the | ||
| * <a href="https://docs.microsoft.com/azure/event-grid/cloud-event-schema">CloudEvent schema</a> is supported across | ||
| * organizations while the <a href="https://docs.microsoft.com/azure/event-grid/cloud-event-schema">EventGridEvent schema</a> is not. |
There was a problem hiding this comment.
| * organizations while the <a href="https://docs.microsoft.com/azure/event-grid/cloud-event-schema">EventGridEvent schema</a> is not. | |
| * organizations while the <a href="https://docs.microsoft.com/azure/event-grid/event-schema">EventGridEvent schema</a> is not. |
There was a problem hiding this comment.
Good catch. Updated
| * @param events the custom events to publish. | ||
| * | ||
| * @return the completion. | ||
| * @throws NullPointerException if events is {@code null}. |
There was a problem hiding this comment.
Add more documentation to this as this is an uncommon scenario. Describe when the user can send custom events and what are the prerequisites for sending a custom event.
| * @throws NullPointerException if events is {@code null}. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||
| public Response<Void> sendCustomEventsWithResponse(Iterable<Object> events, Context context) { |
There was a problem hiding this comment.
More docs for custom event APIs.
| /** | ||
| * Publishes the given EventGrid events to the given topic or domain. | ||
| * @param events the EventGrid events to publish. | ||
| * @throws NullPointerException if events is {@code null}. |
There was a problem hiding this comment.
All service methods (on how to use the API), client builder and clients (how to instantiate a client) should have code snippets in javadoc.
This PR mainly has the API changes for EventGrid beta4:
closes #18281
closes #18276
closes #18275
closes #14926
closes #18427