Skip to content

PubSub not returning any instance. #1510

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;
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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