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

  • How to monitor number of parallel socket connections?

    Hi,

    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?

    Thanks

  • #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 http://docs.spring.io/spring-integra...tml#tcp-events

    Comment


    • #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.

      Comment


      • #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.

        Comment


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

          Comment


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