Using Spring-integration (version 4.0.0.M4), I was using a channel Queue where I Put Mqtt Messages. Multi-threads will take messages from that queue in order to process them.
I needed to know the size of the Queue and to Log it. Warning may be logger if the Queue is reaching some threshold.
So my code look like this:
In the spring-integration.xml (or applicationcontext.xml), I have declared my channel having a Queue.
No in my Code, I use :
@Qualifier(value="mqttMessages")
@Autowired(required=false)
QueueChannel queue;
So I get the channel by its Id. So now I can get the Channel Queue Size using :
queue.getQueueSize()
I needed to know the size of the Queue and to Log it. Warning may be logger if the Queue is reaching some threshold.
So my code look like this:
In the spring-integration.xml (or applicationcontext.xml), I have declared my channel having a Queue.
No in my Code, I use :
@Qualifier(value="mqttMessages")
@Autowired(required=false)
QueueChannel queue;
So I get the channel by its Id. So now I can get the Channel Queue Size using :
queue.getQueueSize()
No comments :
Post a Comment