You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Raghavendran Chellappa <ra...@gmail.com> on 2019/01/25 03:59:02 UTC

Newbie question using Kafka Producers in Web apps

Hi All,
We have a Spring based web app.

We are planning to build an 'Audit Tracking' feature and plan to use Kafka
- as a sink for storing Audit messages (which will then be consumed and
persisted to a common DB).



We are planning to build a simple, ‘pass-through’ REST service which will
take a JSON and push it into the appropriate Kafka topic.

This REST service will be called from various pages (from server side) in
the web app (during Create, View, Edit actions) to store the Audit entries.



My question is can we directly have Kafka Producers in the web app so that
we post messages to Kafka Topic directly (instead of going through a
Webservice)?

Will adding a Kafka Producer in web app will make the app less stable (make
pages less performant)? This is one of the reasons why we want to hide the
Kafka producer complexity behind the webservice. Also we feel that this
webservice can be a starting point for a generic “Auditing service” that
can be used by other applications, in the enterprise, in the future.



I think the ‘pass-through’ webservice is not required and it is OK to push
messages directly from web app to Kafka (but unable to point to any
examples of this being done or any benefits of doing so).



What do you think?



Thanks,

Ragha

Re: Newbie question using Kafka Producers in Web apps

Posted by Michael Eugene <fa...@hotmail.com>.
I don’t feel it would be a big hit in performance because Kafka works very fast. I think the speed difference would be negligible. Why are you worried about stability? I’m just curious because it doesn’t seem like it would be unstable, but maybe it would be a bit overkill for one app and some decoupling might make sense. 

Sent from my iPhone

> On Jan 24, 2019, at 9:59 PM, Raghavendran Chellappa <ra...@gmail.com> wrote:
> 
> Hi All,
> We have a Spring based web app.
> 
> We are planning to build an 'Audit Tracking' feature and plan to use Kafka
> - as a sink for storing Audit messages (which will then be consumed and
> persisted to a common DB).
> 
> 
> 
> We are planning to build a simple, ‘pass-through’ REST service which will
> take a JSON and push it into the appropriate Kafka topic.
> 
> This REST service will be called from various pages (from server side) in
> the web app (during Create, View, Edit actions) to store the Audit entries.
> 
> 
> 
> My question is can we directly have Kafka Producers in the web app so that
> we post messages to Kafka Topic directly (instead of going through a
> Webservice)?
> 
> Will adding a Kafka Producer in web app will make the app less stable (make
> pages less performant)? This is one of the reasons why we want to hide the
> Kafka producer complexity behind the webservice. Also we feel that this
> webservice can be a starting point for a generic “Auditing service” that
> can be used by other applications, in the enterprise, in the future.
> 
> 
> 
> I think the ‘pass-through’ webservice is not required and it is OK to push
> messages directly from web app to Kafka (but unable to point to any
> examples of this being done or any benefits of doing so).
> 
> 
> 
> What do you think?
> 
> 
> 
> Thanks,
> 
> Ragha