Announcement Announcement Module
Collapse
No announcement yet.
Control when sockets are opened by tcp-connection-factory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Control when sockets are opened by tcp-connection-factory

    I'm writing a TCP server application using spring integration and I've come across an interesting problem.

    I need to have a secondary deployment of my application on hot standby waiting if the primary falls over. I need the sockets on the secondary application to remain closed until they need to be opened.

    The tcp-connection-factory seems to create the socket as soon as the context is loaded, is there any way of having the connection factory create the sockets in a closed state and then open them later?

  • #2
    Set auto-startup="false" on the inbound endpoint.

    When you want it to start, send a message to a <control-bus/> with a payload "@endpointName.start()".

    If you don't want to use the <control-bus/> you can also inject the endpoint into your application class and call start() directly.

    That said, it sounds like a "warm" standby because action is needed, a hot standby would be listening and ready to go.

    Comment


    • #3
      I've had a root around the documentation for auto-startup referring to tcp connections and couldn't find anything. Here's what i've got so far ...

      Code:
      <int-ip:tcp-connection-factory id="tcpConnectionFactory" type="server" host="#{properties['host.address']}" 
      			port="#{properties['host.racecardPort']}" single-use="false" so-timeout="#{properties['host.timeout']}" deserializer="javaDeserializer"
          			serializer="javaSerializer" />
      
      <int-ip:tcp-inbound-channel-adapter channel="inboundChannel" id="inbound" connection-factory="tcpConnectionFactory" />

      Comment


      • #4
        May the documentation be damned, its there. Thanks very much for your help

        Comment


        • #5
          It goes on the inbound channel adapter. Most SI components have these lifecycle attributes (defaulting to true) so we don't document them everywhere. Feel free to open a documentation JIRA issue if you wish.

          From the schema...

          Code:
          <xsd:attribute name="auto-startup" type="xsd:string">
          	<xsd:annotation>
          		<xsd:documentation><![CDATA[
              Boolean value indicating whether this endpoint should start automatically.
          		]]></xsd:documentation>
          	</xsd:annotation>
          </xsd:attribute>

          Comment

          Working...
          X