code: public Observable<ServiceResponse<Void>> publishEventsWithServiceResponseAsync(String topicHostname, List<EventGridEvent> events) {
          if (topicHostname == null) {
              throw new IllegalArgumentException("Parameter topicHostname is required and cannot be null.");
          }
          if (events == null) {
              throw new IllegalArgumentException("Parameter events is required and cannot be null.");
          }
          if (this.apiVersion() == null) {
              throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
          }
          Validator.validate(events);
          String parameterizedHost = Joiner.on(", ").join("{topicHostname}", topicHostname);
          return service.publishEvents(events, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
              .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
                  @Override
                  public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
                      try {
                          ServiceResponse<Void> clientResponse = publishEventsDelegate(response);
                          return Observable.just(clientResponse);
                      } catch (Throwable t) {
                          return Observable.error(t);
                      }
                  }
              });
      }
docs: Publishes a batch of events to an Azure Event Grid topic.
  
  @param topicHostname The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net
  @param events An array of events to be published to Event Grid.
  @throws IllegalArgumentException thrown if parameters fail the validation
  @return the {@link ServiceResponse} object if successful.