Announcement Announcement Module
No announcement yet.
How to monitor number of parallel socket connections? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to monitor number of parallel socket connections?


    I have a TcpInboundGateway with configured TcpConnectionFactoryFactoryBean on the server side. I provide a single socket connection for clients.
    I also have a @MessageEndpoint with @ServiceActivator(inputChannel = "serverChannel"). This socket routine takes about 30 seconds on the server until the reply is send back to the client.

    Now I'd like to monitor somehow the count of parallel client connections. And then get a notification above a certain threshold.
    But how could I monitor the parallel active socket connections?


  • #2
    Since 3.0, inject the connection factory into some bean and use connectionFactory.getOpenConnectionIds().size().

    Or use an application listener and monitor the open/close events


    • #3
      So, but connectionFactory.getOpenConnectionIds().size(); will just get me a onetime state of open connections. Should I then probably create a listener on open-events and analyze the openIds() on every event? That would at least work.

      Or are there better ways in general to monitor socket peaks / socket connection counts (during production)?
      Last edited by membersound; Jun 18th, 2014, 01:55 PM.


      • #4
        I am not sure what you mean about one-time - you can export an MBean that calls this method whenever an attribute is accessed.

        But, yes, if you want to track the peak, you would have to use the eventing.


        • #5
          I'm using TcpConnectionFactoryFactoryBean, but there is no getOpenConnectionIds() method. Did I miss anything?


          • Artem Bilan
            Artem Bilan commented
            Editing a comment
            You should use the result of the FactoryBean - AbstractConnectionFactory