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

Add MessageConsumerImpl class, implement pullAsync, add tests #1043

Merged
merged 7 commits into from
Jun 22, 2016

Conversation

mziccard
Copy link
Contributor

@mziccard mziccard commented Jun 7, 2016

This PR adds an implementation for the MessageConsumer interface and implements the MessageConsumer pullAsync(Subscription, MessageProcessor, PullOption...) method. This PR also adds unit and system tests.

A concern that I have about this PR is that the PullOption.executor option (used to provide a custom callback executor to the message consumer) cannot be made serializable. Can we live with that? Better solutions?

@mziccard mziccard added the api: pubsub Issues related to the Pub/Sub API. label Jun 7, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 7, 2016
@mziccard mziccard added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 7, 2016
@mziccard mziccard force-pushed the pubsub-consumer branch 3 times, most recently from 1652076 to 8eafca6 Compare June 8, 2016 09:08
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 85.23% when pulling 8eafca6 on mziccard:pubsub-consumer into 2fd2d56 on GoogleCloudPlatform:pubsub-alpha.

@mziccard
Copy link
Contributor Author

mziccard commented Jun 8, 2016

/cc @aozarov if you want to have a look

@mziccard mziccard added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Jun 8, 2016
@mziccard
Copy link
Contributor Author

mziccard commented Jun 8, 2016

Putting this on hold until changes discussed in #1041 are applied

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 85.849% when pulling 7693456 on mziccard:pubsub-consumer into d487307 on GoogleCloudPlatform:pubsub-alpha.

@mziccard mziccard removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 14, 2016
@mziccard
Copy link
Contributor Author

@aozarov I rebased to get latest changes to the spi layer. PTAL


private static final int MAX_QUEUED_CALLBACKS = 100;
// shared scheduled executor, used to schedule pulls
private static final SharedResourceHolder.Resource<ScheduledExecutorService> TIMER =

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 85.846% when pulling ff4c0a2 on mziccard:pubsub-consumer into d487307 on GoogleCloudPlatform:pubsub-alpha.

@mziccard
Copy link
Contributor Author

@aozarov I did some refactoring according to comments, PTAL

this.deadlineRenewer = builder.deadlineRenewer;
this.queuedCallbacks = new AtomicInteger();
this.timer = SharedResourceHolder.get(TIMER);
this.executorFactory = firstNonNull(builder.executorFactory, new DefaultExecutorFactory());

This comment was marked as spam.

};
}

private PullRequest createPullRequest() {

This comment was marked as spam.

@coveralls
Copy link

coveralls commented Jun 20, 2016

Coverage Status

Coverage increased (+0.09%) to 85.832% when pulling d7ba0aa on mziccard:pubsub-consumer into d487307 on GoogleCloudPlatform:pubsub-alpha.

/**
* Interface for policies according to which the consumer should be restarted.
*/
interface RestartPolicy {

This comment was marked as spam.

This comment was marked as spam.

@aozarov
Copy link
Contributor

aozarov commented Jun 20, 2016

Few minor comments. Overall looks good.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 85.832% when pulling 61bdd81 on mziccard:pubsub-consumer into d487307 on GoogleCloudPlatform:pubsub-alpha.

@aozarov
Copy link
Contributor

aozarov commented Jun 21, 2016

Looks good to me. timer at this point does not need to be ScheduledExecutorService and can be just ExecutorService but I think it is fine to leave it as is if you wish to support future enhancement to NextPullPolicy.

We need someone to look more carefully at the docs and tests. Maybe @lesv ?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 85.837% when pulling 66f273c on mziccard:pubsub-consumer into d487307 on GoogleCloudPlatform:pubsub-alpha.

@mziccard
Copy link
Contributor Author

@lesv do you plan to have a look at this?

@lesv
Copy link
Contributor

lesv commented Jun 22, 2016

Yes - if I'm not cc'd, I don't see it at the moment. Trying to fix it, but I'm still digging out from something in Q1.

@lesv
Copy link
Contributor

lesv commented Jun 22, 2016

LGTM - 1. it seem like we should be able to do something like @SupressWarnings to Codacy
2. Do you write any higher level tests? That actually invoke the API's and talk to a server? It just seems wrong not to have those.

@mziccard
Copy link
Contributor Author

  1. it seem like we should be able to do something like @SupressWarnings to Codacy

Some of these warnings are false positives but in other cases they might still be helpful (I am thinking about the override warning here, I believe we could silent the one on raw exceptions).

  1. Do you write any higher level tests? That actually invoke the API's and talk to a server?

Tests defined in BaseSystemTest are executed against the local emulator (via LocalSystemTest implementation). I haven't pushed an implementation of BaseSystemTest to run tests against the actual service (although I have it and use it before pushing changes) because they take really long (>10 minutes). That will make our build take ~40 minutes which seemed to me a bit too much (given that we already run PubSub tests against the emulator). @aozarov do you have some suggestions? Can we live with such long times?

@lesv
Copy link
Contributor

lesv commented Jun 22, 2016

We should at the very least have them in the repo, even if they don't execute regularly, they should be executed before push to maven. (Which should happen someday soon?)

@aozarov
Copy link
Contributor

aozarov commented Jun 22, 2016

Why do the tests against production take that long? In any case, those should be integration test and not standard unit-tests.

@mziccard
Copy link
Contributor Author

Why do the tests against production take that long?

Unit tests by themselves take around 3 minutes to run. Adding integration tests makes tests take around 10 minutes. It's no surprise given the increased cost of created/getting/deleting resources against the actual service. Also, for MessageConsumer tests, the remote service takes more time (when compared to the emulator) to send back to subscriptions messages that are published to a topic, forcing tests to hang longer waiting that published messages are actually pulled.

In any case, those should be integration test and not standard unit-tests.

This does not change that on PR merges Travis will take around 40 minutes.

I will add the IT tests and configure Travis with a larger timeout.

@mziccard mziccard merged commit 7a7574d into googleapis:pubsub-alpha Jun 22, 2016
@aozarov
Copy link
Contributor

aozarov commented Jun 22, 2016

Maybe it is about time to play with running the tests in parallel?

mziccard added a commit to mziccard/gcloud-java that referenced this pull request Jun 27, 2016
github-actions bot pushed a commit that referenced this pull request Sep 15, 2022
…cies to v3.0.2 (#1043)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `3.0.1` -> `3.0.2` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.2/compatibility-slim/3.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.2/confidence-slim/3.0.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-shared-dependencies</summary>

### [`v3.0.2`](https://togithub.com/googleapis/java-shared-dependencies/blob/HEAD/CHANGELOG.md#&#8203;302-httpsgithubcomgoogleapisjava-shared-dependenciescomparev301v302-2022-09-08)

[Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v3.0.1...v3.0.2)

##### Dependencies

-   Update dependency com.fasterxml.jackson:jackson-bom to v2.13.4 ([#&#8203;789](https://togithub.com/googleapis/java-shared-dependencies/issues/789)) ([6cf91a9](https://togithub.com/googleapis/java-shared-dependencies/commit/6cf91a96b9ea6af0fb845b50582dac7aa2892cab))
-   Update dependency com.google.auth:google-auth-library-bom to v1.10.0 ([#&#8203;781](https://togithub.com/googleapis/java-shared-dependencies/issues/781)) ([8859e61](https://togithub.com/googleapis/java-shared-dependencies/commit/8859e61808bfc5cd9546e27e945fc855b36d2554))
-   Update dependency com.google.auth:google-auth-library-bom to v1.11.0 ([#&#8203;790](https://togithub.com/googleapis/java-shared-dependencies/issues/790)) ([3431a47](https://togithub.com/googleapis/java-shared-dependencies/commit/3431a471cbf874a67a4f1a42e31f0ed891dedc92))
-   Update dependency com.google.auth:google-auth-library-bom to v1.9.0 ([#&#8203;773](https://togithub.com/googleapis/java-shared-dependencies/issues/773)) ([27fc79f](https://togithub.com/googleapis/java-shared-dependencies/commit/27fc79f00ee70011df6a368bb8fcfad7f0ce41f0))
-   Update dependency com.google.errorprone:error_prone_annotations to v2.15.0 ([#&#8203;776](https://togithub.com/googleapis/java-shared-dependencies/issues/776)) ([bf333b8](https://togithub.com/googleapis/java-shared-dependencies/commit/bf333b8c88072d21cb959db4d3328bbb55d9ef5c))
-   Update dependency com.google.protobuf:protobuf-bom to v3.21.5 ([#&#8203;780](https://togithub.com/googleapis/java-shared-dependencies/issues/780)) ([da7f44d](https://togithub.com/googleapis/java-shared-dependencies/commit/da7f44d71d6d7f372b5313dab68ce220308614d4))
-   Update dependency io.grpc:grpc-bom to v1.48.1 ([#&#8203;768](https://togithub.com/googleapis/java-shared-dependencies/issues/768)) ([5c7768d](https://togithub.com/googleapis/java-shared-dependencies/commit/5c7768d3c9665dd356de6c39c0a6a5fa6e992f2e))
-   Update dependency io.grpc:grpc-bom to v1.49.0 ([#&#8203;786](https://togithub.com/googleapis/java-shared-dependencies/issues/786)) ([8734812](https://togithub.com/googleapis/java-shared-dependencies/commit/8734812f1b4e2faaa48caf41eff59a85892ae344))
-   Update dependency org.checkerframework:checker-qual to v3.24.0 ([#&#8203;775](https://togithub.com/googleapis/java-shared-dependencies/issues/775)) ([df74b7b](https://togithub.com/googleapis/java-shared-dependencies/commit/df74b7b0dd5dd592523f302d9fb36adb5991cb0b))
-   Update dependency org.checkerframework:checker-qual to v3.25.0 ([#&#8203;788](https://togithub.com/googleapis/java-shared-dependencies/issues/788)) ([207035b](https://togithub.com/googleapis/java-shared-dependencies/commit/207035bd04c9305899eea540acbefaf06a7b1ec9))
-   Update dependency org.threeten:threetenbp to v1.6.1 ([#&#8203;782](https://togithub.com/googleapis/java-shared-dependencies/issues/782)) ([0f218ae](https://togithub.com/googleapis/java-shared-dependencies/commit/0f218aeb6aa33cf1da4a8b1d6c82bbf87946dab9))
-   Update gax.version to v2.19.0 ([#&#8203;785](https://togithub.com/googleapis/java-shared-dependencies/issues/785)) ([4448331](https://togithub.com/googleapis/java-shared-dependencies/commit/4448331c4c6d88ea8076260776d1d47d24aa19fa))
-   Update google.core.version to v2.8.10 ([#&#8203;787](https://togithub.com/googleapis/java-shared-dependencies/issues/787)) ([3c344d5](https://togithub.com/googleapis/java-shared-dependencies/commit/3c344d515e3b9215db5a1f8ef550d800d974e558))
-   Update google.core.version to v2.8.7 ([#&#8203;774](https://togithub.com/googleapis/java-shared-dependencies/issues/774)) ([d0cd5e8](https://togithub.com/googleapis/java-shared-dependencies/commit/d0cd5e8f6ca88787fe0dbf7f30c849cb4c4fae5e))
-   Update google.core.version to v2.8.8 ([#&#8203;777](https://togithub.com/googleapis/java-shared-dependencies/issues/777)) ([f00571c](https://togithub.com/googleapis/java-shared-dependencies/commit/f00571cd1e9f1c4e011fba4a1e1674c1d8d60200))
-   Update google.core.version to v2.8.9 ([#&#8203;784](https://togithub.com/googleapis/java-shared-dependencies/issues/784)) ([aa8e505](https://togithub.com/googleapis/java-shared-dependencies/commit/aa8e505dbb1214b2239e55d5ac83b00c167d77e4))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-aiplatform).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xOTQuMiIsInVwZGF0ZWRJblZlciI6IjMyLjE5NC4yIn0=-->
github-actions bot pushed a commit that referenced this pull request Sep 19, 2022
🤖 I have created a release *beep* *boop*
---


## [3.3.0](googleapis/java-aiplatform@v3.2.0...v3.3.0) (2022-09-15)


### Features

* add input_artifacts to PipelineJob.runtime_config in aiplatform v1 pipeline_job ([ff7a4ab](googleapis/java-aiplatform@ff7a4ab))
* Add model_monitoring_stats_anomalies,model_monitoring_status to BatchPredictionJob in aiplatform v1beta1 batch_prediction_job.proto ([#1041](googleapis/java-aiplatform#1041)) ([fe03c60](googleapis/java-aiplatform@fe03c60))
* Add read_mask to ListPipelineJobsRequest in aiplatform v1 pipeline_service ([#1032](googleapis/java-aiplatform#1032)) ([ff7a4ab](googleapis/java-aiplatform@ff7a4ab))
* Add UpsertDatapoints and RemoveDatapoints rpcs to IndexService in aiplatform v1 index_service.proto ([#1030](googleapis/java-aiplatform#1030)) ([4114021](googleapis/java-aiplatform@4114021))
* add UpsertDatapoints and RemoveDatapoints rpcs to IndexService in aiplatform v1beta1 index_service.proto ([4114021](googleapis/java-aiplatform@4114021))
* Add WriteFeatureValues in aiplatform v1beta1 featurestore_online_service.proto ([#1022](googleapis/java-aiplatform#1022)) ([267827e](googleapis/java-aiplatform@267827e))


### Dependencies

* Update dependency com.google.api.grpc:proto-google-cloud-aiplatform-v1beta1 to v0.18.0 ([#1021](googleapis/java-aiplatform#1021)) ([c3d34a0](googleapis/java-aiplatform@c3d34a0))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.14.5 ([#1016](googleapis/java-aiplatform#1016)) ([cc0af7b](googleapis/java-aiplatform@cc0af7b))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.14.6 ([#1026](googleapis/java-aiplatform#1026)) ([6ed66cc](googleapis/java-aiplatform@6ed66cc))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.14.7 ([#1031](googleapis/java-aiplatform#1031)) ([5adefd4](googleapis/java-aiplatform@5adefd4))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.15.0 ([#1040](googleapis/java-aiplatform#1040)) ([b6c1b20](googleapis/java-aiplatform@b6c1b20))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.16.0 ([#1044](googleapis/java-aiplatform#1044)) ([5ce52e5](googleapis/java-aiplatform@5ce52e5))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#1043](googleapis/java-aiplatform#1043)) ([40eae55](googleapis/java-aiplatform@40eae55))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 ([#1045](googleapis/java-aiplatform#1045)) ([0f66302](googleapis/java-aiplatform@0f66302))
* Update dependency com.google.cloud:google-cloud-storage to v2.11.3 ([#1015](googleapis/java-aiplatform#1015)) ([7a2fcb0](googleapis/java-aiplatform@7a2fcb0))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants