quento
quento

Reputation: 1114

Netty http count requests

I am writing simple hhtp server using Netty.

How can i count all requests (connections) and active connections using Netty? I am using example https://github.com/netty/netty/tree/4.0/example/src/main/java/io/netty/example/http and trying to count my requests. Should i use my own 'counter' to do that or any ready functions to count?

Also, i need to store some data (for example how many times each request were accessed), what is the best way to store that and where?

Upvotes: 0

Views: 692

Answers (1)

Prim
Prim

Reputation: 2968

You need to implement your own counter, into the handler which handles the http request or into one specific handler added on pipeline for this purpose. I prefer the second option to better separate role of pipeline. Moreover, you can just stop counting by removing the specific handler of pipeline.

Upvotes: 2

Related Questions