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

make pubsub pusher optional #325

Merged
merged 2 commits into from
May 17, 2022
Merged

Conversation

noursaidi
Copy link
Collaborator

@noursaidi noursaidi commented May 9, 2022

Fix following error when running the validator by making the pubsub pusher optional as it is in registrar and elsewhere in the validator

Created service for project projects/daq1-273309/locations/us-central1
Resetting and connecting to pubsub subscription projects/daq1-273309/subscriptions/udmi_target
Resetting existing subscription projects/daq1-273309/subscriptions/udmi_target
java.lang.RuntimeException: While creating PubSubPublisher
	at com.google.daq.mqtt.util.PubSubPusher.<init>(PubSubPusher.java:43)
	at com.google.daq.mqtt.util.PubSubDataSink.<init>(PubSubDataSink.java:35)
	at com.google.daq.mqtt.validator.Validator.validatePubSub(Validator.java:267)
	at com.google.daq.mqtt.validator.Validator.main(Validator.java:143)
Caused by: java.lang.NullPointerException: PubSub publish topic
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:899)
	at com.google.daq.mqtt.util.PubSubPusher.<init>(PubSubPusher.java:37)
	... 3 more
Validation complete, exit 255

@@ -264,7 +264,9 @@ private BiConsumer<Map<String, Object>, Map<String, String>> messageValidator()
private void validatePubSub(String instName) {
String registryId = cloudIotConfig.registry_id;
client = new PubSubClient(projectId, registryId, instName);
dataSink = new PubSubDataSink(projectId, cloudIotConfig.update_topic);
if (cloudIotManager.getUpdateTopic() != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason this isn't the same as the next line (cloudIoTConfig.update_topic) -- aren't they they same?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are the same. I've changed the next line to use cloudIotManager.getUpdateTopic() for consistency with what's in registrar. I don't know which should be preferred over the other

Copy link
Collaborator

Choose a reason for hiding this comment

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

Either one is fine -- it's just that they were mixed within one logical clause.

@noursaidi noursaidi merged commit beaf98a into faucetsdn:master May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants