CCC
CCC

Reputation: 2761

Spring Cloud Stream and GCP pub sub as binder getting stuck

I tried running the example here https://github.com/spring-cloud/spring-cloud-gcp/tree/master/spring-cloud-gcp-samples/spring-cloud-gcp-pubsub-binder-sample I was expecting it to create a topic on my default project. Tomcat service started, but not even the index.html page would load (there should be a message like "Tomcat started on port(s): 8080 (http) with context path ''"), so it seems it got stuck, and it ocurred after I added:

@Autowired
private Source source;

Here is the log

2019-02-14 12:06:54.305  INFO 3560 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on 2019-02-14 12:06:54.309  INFO 3560 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2019-02-14 12:06:55.362  INFO 3560 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be 
(http)
2019-02-14 12:06:56.246  INFO 3560 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-02-14 12:06:56.247  INFO 3560 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.14]
2019-02-14 12:06:56.257  INFO 3560 --- [           main] 2019-02-14 12:06:56.385  INFO 3560 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-02-14 12:06:56.385  INFO 3560 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2027 ms
2019-02-14 12:06:56.970  INFO 3560 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-02-14 12:06:57.079  INFO 3560 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page: class path resource [static/index.html]
2019-02-14 12:06:57.253  WARN 3560 --- [           main] c.g.a.oauth2.DefaultCredentialsProvider  : Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
2019-02-14 12:06:57.383  INFO 3560 --- [           main] o.s.c.g.a.c.GcpContextAutoConfiguration  : The default project ID is xxxxxx-xxxxx
2019-02-14 12:06:58.373  INFO 3560 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel nullChannel
2019-02-14 12:06:58.395  INFO 3560 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel output
2019-02-14 12:06:58.455  INFO 3560 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel errorChannel
2019-02-14 12:06:58.492  INFO 3560 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageHandler errorLogger
2019-02-14 12:06:58.525  INFO 3560 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2019-02-14 12:06:58.525  INFO 3560 --- [           main] o.s.i.channel.PublishSubscribeChannel    : Channel 'application.errorChannel' has 1 subscriber(s).
2019-02-14 12:06:58.525  INFO 3560 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started _org.springframework.integration.errorLogger

What could be happening??

Upvotes: 1

Views: 1189

Answers (2)

CCC
CCC

Reputation: 2761

It was a permissions issue. GOOGLE_APPLICATION_CREDENTIALS environment was set incorrectly.

Upvotes: 0

Elena Felder
Elena Felder

Reputation: 466

Have you defined spring.cloud.stream.bindings.input.destination in your application.properties? The binder will create an anonymous subscription for your topic, if none is configured, but it won't create a topic on its own.

Upvotes: 1

Related Questions