zalando-nakadi / nakadi-producer-spring-boot-starter

Nakadi event producer as a Spring boot starter
MIT License
13 stars 8 forks source link

Don't require token configuration when there already is a Fahrschein bean #75

Closed ePaul closed 6 years ago

ePaul commented 6 years ago

If an application is using Fahrschein directly (for reading events) and this library for producing events, one needs to configure the token stuff (and the Nakadi URL) twice, and one gets two Fahrschein NakadiClients.

Instead, when there is already a spring bean of type org.zalando.fahrschein.NakadiClient, it should just be used for submitting events.

This could be done by having another bean definition like this:

@Bean
NakadiPublishingClient nakadiProducerPublishingClient(NakadiClient fahrscheinNakadiClient) {
   return new FahrscheinNakadiPublishingClient(fahrscheinNakadiClient);
}

It would need to be conditional on an existing NakadiClient bean.