Reputation: 13471
I'm trying to find a way to get the current number of message that I have in the event loop.
I want to put some logs to know if the message are getting enqueue.
I have this Iterator, but I dont think it is since are eventExecutor
Context context = vertx.getOrCreateContext();
ContextInternal contextInt = (ContextInternal) context;
EventLoop eventLoop = contextInt.nettyEventLoop();
Regards.
Upvotes: 2
Views: 194
Reputation: 774
If you cast the result of .nettyEventLoop()
as a NioEventLoop
you can invoke the .pendingTasks
method that should give you the information about the number of tasks scheduled in the event loop.
NioEventLoop eventLoop = (NioEventLoop) ci.nettyEventLoop();
System.out.println(eventLoop.pendingTasks());
JavaDoc about NioEventLoop
implementation:
https://netty.io/4.0/api/io/netty/channel/nio/NioEventLoop.html
Upvotes: 1