8000 PubSub not returning any instance. · Issue #1510 · googleapis/google-cloud-java · GitHub
[go: up one dir, main page]

Skip to content

PubSub not returning any instance. #1510

@vaibhavsw

Description

@vaibhavsw

I'm using Cloud PubSub and trying to get access to the PubSub locally using Service Account JSON credential, but it is not returning anything. Below is the code I'm using to get PubSub instance. Neither it is throwing any exception nor it is returning any PubSub instance. This is an issue which needs to be resolved urgently, anyone can help me.

private PubSub getPubSubForLocal() {

        PubSub pubSub = null;
        InputStream inputStream = getClass().getResourceAsStream("/cloud/vostics-cloud-e56ac878e27e.json");
        try {
            pubSub = PubSubOptions.newBuilder()
                    .setCredentials(ServiceAccountCredentials.fromStream(inputStream))
                    .build()
                    .getService();

        } catch (IOException e) {
            return null;
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

        return pubSub;
    }

Metadata

Metadata

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0