7

I need to disable publication and subscription on events for development, but I can't find some configuration properties/other solution for this. How can I do this?

Possible solution: to create autoconfiguration with @EnableBinding on some property set and in a case of disabled replace all binding interfaces with generated no-op stubs. But maybe more simple solution exist?

injecto
  • 829
  • 1
  • 10
  • 23

3 Answers3

3

I am facing a similar situation where our code will be deployed to production. But these need to be disabled until we have other teams ready to publishing there messages, so we want to tell spring cloud stream to not to initialize any beans until we specify specific configuration.

I tried to look at the what @Vinicius menthod .. but looks that only provides a way to stopping, resuming channels once the application is started.

Is there some thing we can specific to stop these beans while starting an application.

user2225713
  • 253
  • 2
  • 9
2

Selective start and stop of bindings is currently not supported. We are tracking this to be a 2.0 feature. You can track its progress here: https://github.com/spring-cloud/spring-cloud-stream/issues/763

Vinicius Carvalho
  • 3,994
  • 4
  • 23
  • 29
1

One of the options could be injecting an explicit No-Op Binder in the classpath and make it a default binder.

For development purpose (especially you don't really want to publish the events to the real messaging system via any binder implementation), you could use TestSupportBinder from spring-cloud-stream-test-support which lets you test the whole application.

You can find some examples here

Ilayaperumal Gopinathan
  • 4,099
  • 1
  • 13
  • 12
  • Hello, How to inject No-Op binder in the class path? I have a project with rabbit and kafka binders, I want to set no-op binder to destinations that are not ready yet to avoid errors binding consumers for example. – GUISSOUMA Issam Sep 06 '19 at 15:07